my dog learned polymorphism*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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.
It is sorta covered in the JavaRanch Style Guide.
subject: action performed
Similar Threads
actionPerformed to close dialog
how to handle mutiple buttons
Struts, submit button with parameters
Not able to delete file using JButton in a frame
how can i map different Actionform class to single Action class