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

keyboard short cuts in java...

 
jorge zapata
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
jz
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic