This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTextField question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextField question" Watch "JTextField question" New topic
Author

JTextField question

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
Is there any way to make an entry disappear once a user presses
enter. Eg John is typed into a textfield and once the user presses enter the textfield is once again blank
Thank you for your help.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

yup, there is.
When the enter (return) key is pressed in the TextField, an action event is generated and
you could add an action listner which will set the TextField
to " ".
One way of doing it.
regds.
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
 
Don't get me started about those stupid light bulbs.
 
subject: JTextField question
 
Similar Threads
User inputs
TextArea and ActionEvent
JOptionPane Errors
How to submit multiple records in one trip
How to write an event for "Enter" key?