How can I read the string entered in my window's TextField or TextArea after the Enter is pressed? I know how to use the KeyListener to Enter pressing detect,but I don't know how to read this text from my TextField.
TextField generates an ActionEvent and notifies all of its ActionListener when the RETURN key is typed. So in order to be notified your class should implement the ActionListener interface (i.e. implement the public void actionPerformed(ActionEvent e) method). Then to get what has been typed, you just have to invoke getText() upon your TextField instance and that's it... HIH ------------------ Valentin Crettaz Sun Certified Programmer for Java 2 Platform
Or you can set it as a TextListener and it will fire an event everytime a character is entered in the textfield. Depending on what you need your textfield to do that is. ------------------ Michael J Bruesch Codito, ergo sum... I code, therefore I am. My Java Games, I'm quite proud
Michael J Bruesch<br /><i>I code, therefore I am.</i>