Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setDefaultCapable method of JButton

 
Saraswathy Krishnamoorth
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used Border Layout and placed the button in the South. I have set the button's setDefaultCapable property to true. From anywhere in the frame,when I press enter, the button should execute its action event as the buttons setDefaultCapable property is set to true. But it does not work. Please help me. Thanks.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
True is actually the default value. All that this method does is say that this JButton is Capable of being the default. It does not make the JButton the default button.
The JRootPane has a method called JRootPane.setDefaultButton(javax.swing.JButton)
This will set the default button which you are looking for.
Mark
 
Saraswathy Krishnamoorth
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark.
 
Saraswathy Krishnamoorth
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark, can you tell me which event gets fired when Tabs are changed in a TabbedPane.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
probably stateChange, in the ChangeListener interface.
You do know that I am just going to the API Javadoc information to find this stuff out.
The API Documentation is the best way to do it.
Good Luck.
Mark
 
Saraswathy Krishnamoorth
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mark.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic