This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

VK_BACK_SPACE  RSS feed

 
Fred Hosch
Author
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anybody have any problems with KeyEvent.VK_BACK_SPACE in 1.3?
i have a key binding to VK_BACK_SPACE in a JTextWindow that
is generating two action events for each key stroke. when i
change the binding to '\b', i get one event! (the code worked
fine in 1.2.2).
(yeah, i know i should check sun site.)
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get something like that a lot, but the reason has to do with what the action performs.
I have an action that pops up a dialog type window asking some question, when it comes back it does something else.
The key point is the popup. If you have code for a FocusEvent and don't check of isTemporary(), then the code in the FocusEvent will run twice.
example check of isTemporary()
someObject.addFocusListener(new FocusAdapter(){
public void lostFocus(FocusEvent fe){
if (!isTemporary()){
showDialog();
}
}
});
Now in the case of Back_Space, to get back on subject, It might fire an ActionEvent, and you might also have code in the KeyPressed() method of a KeyListener(). I have this happen to me when I am trapping the Enter key which fires an ActionEvent.
Hope this helps you down a good path to solving your issue
Mark Spritzler
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!