On RHEL-5 under the C locale, the caps lock key does not work correctly in a TextArea. The issue appears to be similar to a very old bug: 4080004.
Reproduction instructions:
Reproduction instructions:
1. Under the C locale, launch our testcase with MToolkit.
$ java TextAreaTest
2. Move the input focus to the TextArea window and enter some characters. Lower case characters are displayed in the TextArea.
3. Press Caps Lock key.
4. Input some characters. Lower case characters are displayed in the TextArea. Expected result: upper case characters should be displayed.
Testcase source:
/*
* MyKeyListener.java
*/
import java.awt.event.*;
class MyKeyListener implements KeyListener {
public void keyTyped(KeyEvent event) {
char c = event.getKeyChar();
//System.out.println("###" + event.getComponent().toString() + "###");
String src = event.getComponent().getName();
System.out.println(src + ".keyTyped => " + c + " (0x" + Integer.toHexString((int)c) + ")");
}
public void keyPressed(KeyEvent event) {
String src = event.getComponent().getName();
int code = event.getKeyCode();
String text = event.getKeyText(code);
System.out.println(src + ".keyPressed => [" + text + "] (" + code + ")");
}
public void keyReleased(KeyEvent event) {
;
}
}
/*
* TextAreaTest.java
*/
import java.awt.*;
import java.awt.event.*;
public class TextAreaTest extends TextArea {
public TextAreaTest() {
super();
setText("AWT TextArea component");
addKeyListener(new MyKeyListener());
}
public static void main(String[] args) {
Frame frame = new Frame("AWT TextArea component");
frame.add(new TextAreaTest());
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
System.exit(0);
}
});
frame.setSize(300, 300);
frame.show();
}
}
Reproduction instructions:
Reproduction instructions:
1. Under the C locale, launch our testcase with MToolkit.
$ java TextAreaTest
2. Move the input focus to the TextArea window and enter some characters. Lower case characters are displayed in the TextArea.
3. Press Caps Lock key.
4. Input some characters. Lower case characters are displayed in the TextArea. Expected result: upper case characters should be displayed.
Testcase source:
/*
* MyKeyListener.java
*/
import java.awt.event.*;
class MyKeyListener implements KeyListener {
public void keyTyped(KeyEvent event) {
char c = event.getKeyChar();
//System.out.println("###" + event.getComponent().toString() + "###");
String src = event.getComponent().getName();
System.out.println(src + ".keyTyped => " + c + " (0x" + Integer.toHexString((int)c) + ")");
}
public void keyPressed(KeyEvent event) {
String src = event.getComponent().getName();
int code = event.getKeyCode();
String text = event.getKeyText(code);
System.out.println(src + ".keyPressed => [" + text + "] (" + code + ")");
}
public void keyReleased(KeyEvent event) {
;
}
}
/*
* TextAreaTest.java
*/
import java.awt.*;
import java.awt.event.*;
public class TextAreaTest extends TextArea {
public TextAreaTest() {
super();
setText("AWT TextArea component");
addKeyListener(new MyKeyListener());
}
public static void main(String[] args) {
Frame frame = new Frame("AWT TextArea component");
frame.add(new TextAreaTest());
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
System.exit(0);
}
});
frame.setSize(300, 300);
frame.show();
}
}