• Post Reply Bookmark Topic Watch Topic
  • New Topic

JButtons

 
Patrick Mugabe
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone!!!
I am having problems when I use the 'Enter' instead of using the mouse to click a button.
The event type I am using is ActionEvent.
However, when I use the space bar, I get a response.Is this a problem with my keyboard settings or it's something else?
Please help....
 
Rene Liebmann
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No this is Java, it is not your keyboard! I don't know the reason, but Java has lots of key assignments for every component. There you can read that space bar will fire an action performed event. I could imagine, that this fact has something to do with OS independence?!
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You create create a keylistener on the the buttons, and then catch the spacebar key event, and tell it to ignore it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!