This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

About Keybinding  RSS feed

 
Kasun Wixkramanayake
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

if i use "control alt 7" as key strokes this Code work properly but if use "control s" it dose not work .
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried using "control S"?
 
Kasun Wixkramanayake
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i tried but stil it dosent work
 
Kasun Wixkramanayake
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

in my case i have two buttons called add_button and search_button.I used "control S" for search_button and "control A" for add_button. "control S" is working properly as you said but "control A "is not working
 
Rob Camick
Ranch Hand
Posts: 2800
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe another component is intercepting the KeyStroke.

For example text components use "Control A" to select the text of the component.

If you need more help then post your SSCCE demonstrating the problem.
 
Rob Spoor
Sheriff
Posts: 21090
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kasun Wixkramanayake wrote:

I always prefer the direct way, that doesn't require parsing:
Note that in this case the 'S' needs to be uppercase, or it will be an incorrect key code.

For those wondering, 'S' == KeyEvent.VK_S. I prefer the short version.
 
Rob Camick
Ranch Hand
Posts: 2800
15
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like using the String so I don't have to create a separate key for the InputMap/ActionMap:

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!