Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Ctrl - A (or other letters) to String

Status
Not open for further replies.

stoolpigeon

Programmer
Aug 1, 2001
309
US
I have a string and I would like to place values in that string that correspond to pressing the control key and a letter key at the same time.

If I have String tmp I would like to be able to assign it the value Ctrl A. Then I plan to use the getBytes method of tmp to pass an array of bytes to another function.

thank you for any help.
 
Is this what you are looking for?

JMenuItem openItem = fileMenu.add(new TestAction("Open"));
openItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_A, InputEvent.CTRL_MASK));
 
I need ,if possible, the string to have the value of that key combination. this is for a telnet app and I am trying to set it up so that the user can click on a button and have the application send ctrl+A, or any other letter, to the terminal without having to use the keyboard.

hope that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top