Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

action performed

 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey guys,
can u kindly tell me how to do this. say i want to perform an action like this. when i press the enter button from the keyboard it should activate my search button in the program. i know this is some thing to do with rootpane...
please let me know the setps
i have a jpanel which i have used to add the button.
thanks
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah... it's JRootPane.setDefaultButton( JButton )... you would just do something like this in your JPanel that has the button.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic