JRootPane.setDefaultButton(JButton defaultButton)
HTH
Alex Molochnikov
Gestalt Corporation
www.gestalt.com
> I'm just wondering how I can create a "default" button click when hitting the
> Return/Enter key. In VB, this is simply a matter of assigning a specific propery
[quoted text clipped - 3 lines]
> --
> Chris Shepherd
Chris Shepherd - 19 Dec 2003 16:25 GMT
> JRootPane.setDefaultButton(JButton defaultButton)
Thanks a bundle! I knew it was simpler than I'd initially figured it would be.

Signature
Chris Shepherd
> I'm just wondering how I can create a "default" button click when hitting the
> Return/Enter key. In VB, this is simply a matter of assigning a specific propery
> to the default button to be pressed, but I am at a loss for how to do it in Java
> without using an ActionListener. Is there a similar way of doing it?
I really have no idea what you mean with the
VB example, but am curious as to why you
do _not_ want to use an action listener?
An ActionListener would be the Java way
to act on button clicks.
--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Chris Shepherd - 19 Dec 2003 16:20 GMT
> I really have no idea what you mean with the
> VB example, but am curious as to why you
> do _not_ want to use an action listener?
>
> An ActionListener would be the Java way
> to act on button clicks.
Except, say I have a window with 30 or so JTextFields on it. Not all of it needs
data entered, etc.. I need it as a data entry application, and when I hit return
I want it to submit the changes and change to a new window. To do it with an
actionlistener would require that for each of the 30 JTextFields I set the
ActionListener object, and that's a lot more difficult and convoluted than
simply having a button press associated with enter, like the other poster in
this thread gave. Basically I'm aiming for efficiency and saving work. :)

Signature
Chris Shepherd