File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes doClick and trapping of enter key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "doClick and trapping of enter key" Watch "doClick and trapping of enter key" New topic
Author

doClick and trapping of enter key

Gaurav Chikara
Ranch Hand

Joined: Jun 09, 2000
Posts: 410
Is ther any way in which we can forcibly invoke button's action event As far as I remember there is some method doClick() but I am not able to figure it out in button class
Can any one also pls let me knoe as how can I trap the enter key of keyboard
Actually I want that on pressing enter key button.doClick method should be triggered
Thnkx in advance


SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
Dorothy Finkel-Laverty
Ranch Hand

Joined: Nov 24, 2001
Posts: 51
I think you have a whole bunch of questions in here.
Your first question:
Is ther any way in which we can forcibly invoke button's action event

Take a look at the API for AbstractButton - you would say myButton.doClick(); That makes your program act as if the user has physically clicked on the button.
Have you registered your button with the action listener object? Once you do that, the doClick method should be triggered when the user clicks on the button.
Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
This might help you

Thank you
Garandi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doClick and trapping of enter key