It's not a secret anymore!
The moose likes Swing / AWT / SWT and the fly likes action performed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "action performed" Watch "action performed" New topic

action performed

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
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.

SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Yeah... it's JRootPane.setDefaultButton( JButton )... you would just do something like this in your JPanel that has the button.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: action performed
It's not a secret anymore!