Details
-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b110
-
linux
Description
FULL PRODUCT VERSION :
jdk 7
ADDITIONAL OS VERSION INFORMATION :
Ubuntu 12.10
A DESCRIPTION OF THE PROBLEM :
I will include code to show the problem:
@Override
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
int diff;
if( keyCode == KeyEvent.VK_DOWN || keyCode == KeyEvent.VK_UP) {
e.consume();
diff = 1;
if( keyCode == KeyEvent.VK_DOWN) diff = -1;
if( keyIndex > 0) {
long time1 = System.currentTimeMillis();
long diff1 = time1 - currKeyTime;
IJ.showStatus( " diff = " + diff1 + " , curr= " + currKeyTime);
if( diff1 >= 0 && diff1 < keyDelay[keyIndex]) return;
currKeyTime = time1;
}
petCtPanel1.incrSlicePosition(diff, false);
}
if( keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_RIGHT) {
e.consume();
diff = 1;
if( keyCode == KeyEvent.VK_LEFT) diff = -1;
keyIndex += diff;
if( keyIndex < 0) keyIndex = 0;
if( keyIndex >= 9) keyIndex = 9;
IJ.showStatus( " Key delay = " + keyIndex);
}
if( keyCode == KeyEvent.VK_HOME) {
e.consume();
petCtPanel1.incrSlicePosition(1000, false);
}
}
@Override
public void keyReleased(KeyEvent e) {
currKeyTime = 0;
}
The currKeyTime gets zeroed only on the key Released event. However the show status prints it value as a fixed zero. If I comment out the command in the key Released event, everything works as expected. This leads to one conclusion, i.e. the keyReleased event is being generated even if I hold down the key and I do not release it.
This happens only in Linux. I checked it on Windows XP and on XP it works as expected. If you need to contact me use ilan.tal(at)gmail.com.
Thanks,
Ilan
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
expect it NOT to reach keyReleased when the key is not released.
ACTUAL -
reaches keyReleased always.
REPRODUCIBILITY :
This bug can be reproduced always.
jdk 7
ADDITIONAL OS VERSION INFORMATION :
Ubuntu 12.10
A DESCRIPTION OF THE PROBLEM :
I will include code to show the problem:
@Override
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
int diff;
if( keyCode == KeyEvent.VK_DOWN || keyCode == KeyEvent.VK_UP) {
e.consume();
diff = 1;
if( keyCode == KeyEvent.VK_DOWN) diff = -1;
if( keyIndex > 0) {
long time1 = System.currentTimeMillis();
long diff1 = time1 - currKeyTime;
IJ.showStatus( " diff = " + diff1 + " , curr= " + currKeyTime);
if( diff1 >= 0 && diff1 < keyDelay[keyIndex]) return;
currKeyTime = time1;
}
petCtPanel1.incrSlicePosition(diff, false);
}
if( keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_RIGHT) {
e.consume();
diff = 1;
if( keyCode == KeyEvent.VK_LEFT) diff = -1;
keyIndex += diff;
if( keyIndex < 0) keyIndex = 0;
if( keyIndex >= 9) keyIndex = 9;
IJ.showStatus( " Key delay = " + keyIndex);
}
if( keyCode == KeyEvent.VK_HOME) {
e.consume();
petCtPanel1.incrSlicePosition(1000, false);
}
}
@Override
public void keyReleased(KeyEvent e) {
currKeyTime = 0;
}
The currKeyTime gets zeroed only on the key Released event. However the show status prints it value as a fixed zero. If I comment out the command in the key Released event, everything works as expected. This leads to one conclusion, i.e. the keyReleased event is being generated even if I hold down the key and I do not release it.
This happens only in Linux. I checked it on Windows XP and on XP it works as expected. If you need to contact me use ilan.tal(at)gmail.com.
Thanks,
Ilan
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
expect it NOT to reach keyReleased when the key is not released.
ACTUAL -
reaches keyReleased always.
REPRODUCIBILITY :
This bug can be reproduced always.