| Other | Other |
|---|---|
| 1.2.2 1.2.2Fixed | 1.3.0Fixed |
|
Duplicate :
|
|
|
Duplicate :
|
|
|
Duplicate :
|
|
|
Duplicate :
|
|
|
Relates :
|
********************************************************************************
This bug record is specific to Java 2 SDK Standard Edition v. 1.2 and v. 1.2.1.
Please do not add customer calls relating to 1.1.x to this record.
********************************************************************************
Name: tb29552 Date: 11/03/98
/*
JTextPane no longer dispatches keyTyped events
The following code reproduces this problem.
When run under i586/win_nt_4.0 you will see
only the keyPressed and keyReleased events.
Run the same demo under SPARC/Solaris and you
will see keyPressed, keyTyped and keyReleased
for each key you strike.
This showed up under JDK 1.2 RC 1 and worked
fine under JDK 1.2beta4:
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
* Demonstrates problems with JDK1.2 RC 1--JTextPane no longer
* dispatches keyTyped events like it used to in JDK1.2beta4. Typing
* some characters in the pane after startup will show that only
* keyPressed and keyReleased events are generated...
*/
public class TestJTP {
private static final float INITIAL_DOC_HEIGHT_PERCENT = 0.20f;
private static final float INITIAL_WIDTH_PERCENT = 0.37f;
public static void main(String[] argv) {
JFrame aFrame = new JFrame();
Dimension aScreenRes = Toolkit.getDefaultToolkit().getScreenSize();
aScreenRes.height = (int) (INITIAL_DOC_HEIGHT_PERCENT
* aScreenRes.height);
aScreenRes.width = (int) (INITIAL_WIDTH_PERCENT
* aScreenRes.width);
JTextPane itsTextPane = new JTextPane();
JScrollPane itsScrollPane = new JScrollPane(itsTextPane,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
itsScrollPane.setPreferredSize(aScreenRes);
// Register the listener to keep track of keyboard events:
itsTextPane.addKeyListener(
new KeyAdapter() {
public void keyTyped(KeyEvent e) {
System.out.println("Key type detected:" + e.getKeyChar());
}
public void keyPressed(KeyEvent e) {
System.out.println("Key press detected:" + e.getKeyChar());
}
public void keyReleased(KeyEvent e) {
System.out.println("Key release detected:" + e.getKeyChar());
}
}
);
aFrame.getContentPane().setLayout(new BorderLayout());
aFrame.getContentPane().add(itsScrollPane, "Center");
aFrame.pack();
aFrame.setVisible(true);
}
}
(Review ID: 41481)
======================================================================
daniel.indrigo@Canada 1999-01-19
JTextfield has the same problem
|