-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b33
-
x86
-
windows_2000
FULL PRODUCT VERSION :
1.4.2_03
ADDITIONAL OS VERSION INFORMATION :
OS ver, Windows 2000, SP4
A DESCRIPTION OF THE PROBLEM :
On a JWindow, a JTextField is placed to accept user input. The window's owner JFrame is iconified when the JWindow is opened. The JTextField accepts keyboard input but will not display the space character (keycode 32) The listener actually receives the event and the keycode, but the physical rendering of the JTextField does not place the space there. All other characters work fine. Recently upgraded from SDK 1.4.1 to 1.4.2 and this is when the problem occurred.
When owner frame is deiconified, it works fine.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
complile and run the code below to produce a simple test case that duplicates this problem.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The JTextfield should take all characters, including the space character.
ACTUAL -
The space character was accepted as an input to a listener placed on the text field, but no space was rendered in the field.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class WindowTest extends JWindow {
JTextField textfield;
public WindowTest(JFrame owner) {
super(owner);
// owner frame needs to be iconified when JWindow opens, the text field
// will not display the space character in this mode; Works OK in
// previous (1.4.1) SDK. (It will accept the event however)
owner.setExtendedState(JFrame.ICONIFIED);
textfield = new JTextField();
textfield.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
System.out.println(e.getKeyCode());
}
});
getContentPane().add(textfield, BorderLayout.NORTH);
setBounds(300, 300, 200, 200);
setVisible(true);
}
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
frame.setSize(100, 100);
WindowTest test = new WindowTest(frame);
frame.setVisible(true);
test.textfield.requestFocus();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
In listener, keyReleased or keyTyped event, add:
if(e.getKeyCode()==32 && owner.getState() == JFrame.ICONIFIED){
textfield.setText(textfield.getText()+" ");
}
Release Regression From : 1.4.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
###@###.### 2005-1-31 21:47:53 GMT
1.4.2_03
ADDITIONAL OS VERSION INFORMATION :
OS ver, Windows 2000, SP4
A DESCRIPTION OF THE PROBLEM :
On a JWindow, a JTextField is placed to accept user input. The window's owner JFrame is iconified when the JWindow is opened. The JTextField accepts keyboard input but will not display the space character (keycode 32) The listener actually receives the event and the keycode, but the physical rendering of the JTextField does not place the space there. All other characters work fine. Recently upgraded from SDK 1.4.1 to 1.4.2 and this is when the problem occurred.
When owner frame is deiconified, it works fine.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
complile and run the code below to produce a simple test case that duplicates this problem.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The JTextfield should take all characters, including the space character.
ACTUAL -
The space character was accepted as an input to a listener placed on the text field, but no space was rendered in the field.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class WindowTest extends JWindow {
JTextField textfield;
public WindowTest(JFrame owner) {
super(owner);
// owner frame needs to be iconified when JWindow opens, the text field
// will not display the space character in this mode; Works OK in
// previous (1.4.1) SDK. (It will accept the event however)
owner.setExtendedState(JFrame.ICONIFIED);
textfield = new JTextField();
textfield.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
System.out.println(e.getKeyCode());
}
});
getContentPane().add(textfield, BorderLayout.NORTH);
setBounds(300, 300, 200, 200);
setVisible(true);
}
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
frame.setSize(100, 100);
WindowTest test = new WindowTest(frame);
frame.setVisible(true);
test.textfield.requestFocus();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
In listener, keyReleased or keyTyped event, add:
if(e.getKeyCode()==32 && owner.getState() == JFrame.ICONIFIED){
textfield.setText(textfield.getText()+" ");
}
Release Regression From : 1.4.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
###@###.### 2005-1-31 21:47:53 GMT