|How do I implement this dialog behavior? [message #461018]
||Wed, 14 September 2005 18:29
Originally posted by: gilbert.pilz.sbc-guesstherest.net|
I have a dialog that has two text fields (URL and user name) and two
buttons (Connect and Cancel). I want to implement the following behavior:
1.) If the user tries to press Connect and either of the two text fields
are empty the dialog automatically refocuses on the empty text field.
2.) If the user presses <enter> while the focus is on either of the text
fields the dialog behaves as if the Connect were pressed (including the
validation performed in (1).
I've already implemented (1) by using a FocusListener on the Connect
button. I figure I can do (2) by adding a KeyListener to the text fields
that watches for <enter> and does "the right thing". I'm worried that
this might cause some weird behavior if one of the text fields is empty.
I'm also wondering if there is some more elegant way of implementing
this. Also, is there some way of visually cueing the user that the
Connect button will be pressed if they hit <enter>?
Powered by FUDForum
. Page generated in 0.01693 seconds