Ok, I think that I've overcome most of the problems I was having getting all this set up. (Turns out I was improperly using the KeyListener, so that nothing was getting picked up.)
Anyway, now when I type in my jTextField, KeyEvents will trigger as intended, and if I throw a toString() in the KeyLogger, I get the same kind of information that Solar posted.
Now I'm trying to actually use the information I'm getting from the KeyListener in my program, and I'm coming up a little short.
What I'm trying to do is have the user enter their name. Should be easy, yes?
The code that I'm trying to write is something along the lines of:
(note: jTextField1 has the KeyListener attached to it)
... (//code before this)
jTextField2.setText("What name will you be known by?: ");//another textbox set above the one that the user enters information on.
jTextField1.setText(null);//clears the old information that was in the textbox.
While (done == false){ //while waits for the information to be entered.
if (jTextField1.*command I can't figure out* == enter){ //SHOULD wait for user to press enter, then grab the name so that it can contune.
input = jTextField1.getText();
done = true;
}
}
... (//code after this)
But there doesn't seem to be any way to access jTextField1's KeyListener that I can figure out. I dunno, maybe I'm trying to go about this the wrong way. How do I get the main body of my code to realize when enter is pressed?