-
Enhancement
-
Resolution: Won't Fix
-
P3
-
1.4.0, 1.4.2, 6
-
generic, x86
-
generic, windows_2000, windows_xp
Name: sv35042 Date: 10/08/2002
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION : Windows 2000 5.00.2195 SP2
ADDITIONAL OPERATING SYSTEMS : n/a
A DESCRIPTION OF THE PROBLEM :
The JSpinner class supports the addKeyListener method of
Component, but the spinner never calls the keyPressed,
keyReleased, or keyTyped methods of an object implementing
the KeyListener interface. Also, using getEditor
().addKeyListener, to add a KeyListener to the JComponent
that is the JSpinner editor works without error, however,
it never calls any of the KeyListener methods either.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a JSpinner with a model.
2. addKeyListener directly to the JSpinner object
3. addKeyListener to the JSpinner editor retrieved by
getEditor.
4. Implement keyPressed, keyReleased, keyTyped, and verify
that these methods are never invoked when a keyboard action
occurs on the spinner.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Each of the KeyListener methods should have been invoked
due to pressing a key while the JSpinner had focus. This
never happened.
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*
import javax.swing.*;
public class Test extends JFrame implements KeyListener {
public static void main(String args[]) {
new Test();
}
public Test() {
SpinnerNumberModel model = new SpinnerNumberModel();
model.setMinimum(new Integer(1));
model.setMaximum(new Integer(10));
JSpinner spinner = new JSpinner(model);
spinner.addKeyListener(this);
spinner.getEditor().addKeyListener(this);
getContentPane().add(spinner);
setSize(100, 100);
show();
}
public void keyPressed(KeyEvent ke) {
System.out.println("key " + ke.getKeyCode() + " pressed on " + ke.getSource
());
}
public void keyReleased(KeyEvent ke) {
System.out.println("key " + ke.getKeyCode() + " released on " + ke.getSource
());
}
public void keyTyped(KeyEvent ke) {
System.out.println("key " + ke.getKeyCode() + " typed on " + ke.getSource
());
}
---------- END SOURCE ----------
(Review ID: 143609)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION : Windows 2000 5.00.2195 SP2
ADDITIONAL OPERATING SYSTEMS : n/a
A DESCRIPTION OF THE PROBLEM :
The JSpinner class supports the addKeyListener method of
Component, but the spinner never calls the keyPressed,
keyReleased, or keyTyped methods of an object implementing
the KeyListener interface. Also, using getEditor
().addKeyListener, to add a KeyListener to the JComponent
that is the JSpinner editor works without error, however,
it never calls any of the KeyListener methods either.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a JSpinner with a model.
2. addKeyListener directly to the JSpinner object
3. addKeyListener to the JSpinner editor retrieved by
getEditor.
4. Implement keyPressed, keyReleased, keyTyped, and verify
that these methods are never invoked when a keyboard action
occurs on the spinner.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Each of the KeyListener methods should have been invoked
due to pressing a key while the JSpinner had focus. This
never happened.
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*
import javax.swing.*;
public class Test extends JFrame implements KeyListener {
public static void main(String args[]) {
new Test();
}
public Test() {
SpinnerNumberModel model = new SpinnerNumberModel();
model.setMinimum(new Integer(1));
model.setMaximum(new Integer(10));
JSpinner spinner = new JSpinner(model);
spinner.addKeyListener(this);
spinner.getEditor().addKeyListener(this);
getContentPane().add(spinner);
setSize(100, 100);
show();
}
public void keyPressed(KeyEvent ke) {
System.out.println("key " + ke.getKeyCode() + " pressed on " + ke.getSource
());
}
public void keyReleased(KeyEvent ke) {
System.out.println("key " + ke.getKeyCode() + " released on " + ke.getSource
());
}
public void keyTyped(KeyEvent ke) {
System.out.println("key " + ke.getKeyCode() + " typed on " + ke.getSource
());
}
---------- END SOURCE ----------
(Review ID: 143609)
======================================================================
- duplicates
-
JDK-5086419 JSpinner component does not fire MouseEvent.
- Closed