Re: Ditching focus of a JTextField



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
.