dcsimg
how to set default focus on a JButton
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   meenu_gupta
Posted On:   Sunday, May 4, 2003 09:44 PM

I have a form with few textfields and buttons , i want to set default focus to a particular buttton?

Re: how to set default focus on a JButton

Posted By:   Bahman_Barzideh  
Posted On:   Monday, May 5, 2003 05:04 AM

Your question is a bit vauge, so I have to make a few assumptions.
If you have a JFrame or a JDialog and would like to set one of the button in its
conent pane as the default (hitting enter is the same as clicking the button)
you can try the following:

JRootPane rootPane = frame.getRootPane ();
rootPane.setDefaultButton (button);
About | Sitemap | Contact