Re: Ditching focus of a JTextField
- From: Vova Reznik <byRequest@xxxxxxxxxxxx>
- Date: Tue, 27 Sep 2005 15:14:37 GMT
java.awt.Component protected void processFocusEvent(FocusEvent e)
.... // --- after input is complete --- super.processFocusEvent(new FocusEvent(this, FocusEvent.FOCUS_LOST));
this - your textField. You should subclass JTextField to have access to that method.
Rob McDonald wrote:
I have implemented a simple JTextField in my application. I am using an ActionListener to perform an action when the user presses enter after completing input. This works fine....
However, after pressing enter, the cursor remains blinking in the box. The user has no feedback that his input has been accepted. I need to force the focus away from the textfield after input is complete. However, I don't really want focus to go anywhere else in particular....
Also, is there an event that triggers when a user manually changes focus off of the text box? I would like my action to occur any time the user changes the value (once they're done typing and has changed focus by clicking on something else), not just when the user presses enter.
Thanks in advance,
Rob
.
- References:
- Ditching focus of a JTextField
- From: Rob McDonald
- Ditching focus of a JTextField
- Prev by Date: Ditching focus of a JTextField
- Next by Date: Re: Ditching focus of a JTextField
- Previous by thread: Ditching focus of a JTextField
- Next by thread: Re: Ditching focus of a JTextField
- Index(es):