wood burning stoves
The moose likes Swing / AWT / SWT and the fly likes keyboard short cuts in java... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "keyboard short cuts in java..." Watch "keyboard short cuts in java..." New topic

keyboard short cuts in java...

jorge zapata

Joined: Oct 02, 2001
Posts: 10
does anyone know how to emulate a keyboard short cut in java? for example, run the same command as ctrl-c when a specific event it triggered from my java code??? it's currently running from an applet. i want people to NOT directly use ctrl-c but to click on something and have that fire the ctrl-c for them.
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
did you have specific key combos you were trying to emulate or did you want it open to anything? Are you trying to (as per your example) copy stuff to the system clipboard? Or is just for use inside your java code?
jorge zapata

Joined: Oct 02, 2001
Posts: 10
ok here is the deal, your questions are definitely good. i shall explain more...
i am in a jdbtable implemented by a borland dataSet (that's only background information). if i highlight a bunch of rows and do ctrl-c it will copy the data and i can do a ctrl-v into excel or anyother application.
now, our users are not very keyboard short cut savy at all.
i have set up a menu when they right click to say copy (which is a copy field) to grab data in the cell and put it into the clip board for later use.
now i want to add a copy row and copy rows selected. i am trying to copy all the data in all the rows selected and put them in the clipboard. the ctrl-c works, now if i could call the ctrl-c function from my code that would be all i have to do.
if i cannot do that, i will have to write code to figure out what rows are selected and grab the columns etc... and put that in the clipboard. and that is what i am trying to avoid to do. all i want to do is use the existing ctrl-c from a java action performed.
thanks you in advance,
I agree. Here's the link: http://aspose.com/file-tools
subject: keyboard short cuts in java...
It's not a secret anymore!