A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Java
»
Swing / AWT / SWT
Author
keyPressed method is called twice
Rami Nassar
Greenhorn
Joined: Feb 23, 2011
Posts: 13
posted
Apr 23, 2012 01:48:18
0
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
Joined: Jun 09, 2003
Posts: 4632
posted
Apr 23, 2012 02:16:57
0
have you added the listener
twice?
Rami Nassar
Greenhorn
Joined: Feb 23, 2011
Posts: 13
posted
Apr 23, 2012 02:28:53
0
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 :)
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: keyPressed method is called twice
Similar Threads
Regarding Event handling for TextField when Tab Pressed
Restricting the TextField To accept only a set no of characters
Problem with KeyEvent and VK_TAB
KeyListener
Control-Enter
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter