It's not a secret anymore!
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextField question" Watch "JTextField question" New topic

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.
- satya

Take a Minute, Donate an Hour, Change a Life
I agree. Here's the link:
subject: JTextField question
It's not a secret anymore!