Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

keyPressed method is called twice

 
Rami Nassar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I override method keyPressed on my swing dialog but its called twice, can any one give me a hint?!!

/**
* Invoked when a key has been pressed.
* See the class description for {@link KeyEvent} for a definition of
* a key pressed event.
*/
public void keyPressed(KeyEvent ke) {
if( ke.getKeyCode() == KeyEvent.VK_F2) {
updateButtonactionPerformed();
} else if( ke.getKeyCode() == KeyEvent.VK_F3) {
openBiddingButtonactionPerformed();
} else if( ke.getKeyCode() == KeyEvent.VK_F4) {
deleteButtonactionPerformed();
} else if( ke.getKeyCode() == KeyEvent.VK_F5) {
closeButtonactionPerformed();
} else if( ke.getKeyCode() == KeyEvent.VK_F6) {
openAuctionPlatesLookup();
} else if( ke.getKeyCode() == KeyEvent.VK_RIGHT) {
populatePreviousPlate();
} else if( ke.getKeyCode() == KeyEvent.VK_LEFT) {
populateNextPlate();
}
}
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you added the listener twice?
 
Rami Nassar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:have you added the listener twice?



OMG.. yes I added it twice by mistake.. I remove it and its working fine.. thanks alot my friend :)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic