focusLost vs. actionPerformed
- From: "Richard F.L.R.Snashall" <rflrs@xxxxxxxxxxxxx>
- Date: Tue, 26 Sep 2006 12:28:39 -0400
I have a number of JTextField components that allow user entry.
I have set up both an ActionListener and a FocusListener so that,
for either actionPerformed or focusLost, the value is examined
for validity. If it is invalid, a message dialog is put up
indicating the unacceptable entry.
I leave the user input in the JTextField while the message dialog
is up to allow the user to mentally acknowledge the error, but
replace the old input value when the message dialog is done.
However, if the bad input is via actionPerformed, acknowledging
the message dialog seems to cause a loss of focus. On at least
my machine, the focusLost process is started before completion
of the actionPerformed process. As a result, as the bad value
is still in the input field, the message dialog comes up again.
Is this something that can be counted upon (ignoring focusLost
while actionPerformed is running), or do I need to take some kind
of additional precautions?
.
- Follow-Ups:
- Re: focusLost vs. actionPerformed
- From: Karsten Lentzsch
- Re: focusLost vs. actionPerformed
- From: Fred Kleinschmidt
- Re: focusLost vs. actionPerformed
- Prev by Date: Re: TreePath
- Next by Date: Re: ComboBox width before setVisible??
- Previous by thread: TreePath
- Next by thread: Re: focusLost vs. actionPerformed
- Index(es):
Relevant Pages
|