-
Bug
-
Resolution: Fixed
-
P2
-
1.1.6, 1.1.8, 1.2.0
-
1.2beta4
-
generic, sparc
-
solaris_2.5.1, solaris_2.6
-
Verified
Platform : solaris 2.5, 2.6
Locale : zh, zh_TW
JDK version : 1.1.6
1) IMFTest
lightweight component :
- if there is only one Chinese character candidate for
the text you just composed. You can enter it directly.
The component will take it.
- If there are more than one Chinese charcaters to be chosen for the
thing you just composed, you select one canidate. This time the
component will not take it.
Peered Component : Pass
2) SwingSet
Same as IMFTest
3) Hjb
Same as IMFTest
- 4105612: LIGHT WEIGHT TEXTS HAVE PROBLEM INPUTTING FOR CJK CHAR SETS
which may be related to
- 4267381: Some FOCUS_LOST events were marked as Permanent, causing
problems
for lightweight components suh as Oracle's.
Bug 4105612 indicates in the description that it has been fixed but without
providing the version of the JRE.
Here are our notes:
To test the inputing problem of Chinese characters in Java lightweight text
component when there are multiple candidates, we produced two test cases:
BaliTest.java, which tests Bali LWTextField; LWText.java, which tests Java
lightweight text field. The compiler used is JDK 1.1.6, and run time
environment is JRE 1.1.8_09. Four languages have been tested: Japanese,
Traditional Chinese, Simplified Chinese and Korean, thanks to respective
testers: Peter Linsley(plinsley@us), Sapho Chang(schang@tw), Howard
Yang(hyang@cn), Bogeon Kim(bgkim@kr).
Test results for Japanese is a little different. When the window activation
policy is "Click in window to make active"(w/o workaround), sometimes users
can input the characters when there are multiple candidates. We observe the
same behavior for Japanese when testing JRE 1.1.7B, the success percentage
depends on the CPU speed. I have tried 8 times, it failed on 4th and 5th
trail. When the window activation policy is "Point in window to make
active"(w/ workaround), user can input Kanji successfully.
Test results for Traditional Chinese and Korean is the same as the testing
results for JRE 1.1.7B. That is user can NOT input Chinese Chars w/o
workaround, while the input works w/ workaround.
Test results for Simplified Chinese is the same as JRE 1.1.7B, too. User
can NOT input Chinese chars with or without workaround.
This is the second bug.
- PULL DOWN LISTS DON'T SELECT WHEN DOING A CLICK (WITH NO DRAG) AND CLICK
This bug was just found and has the following notes:
Verified that this is a JRE 1.1.8_09 bug:
Tested on a Solaris 2.6 machine which was upgraded to include all
required and recommended OS patches for JRE 1.1.8_09. Does not happen
with
JRE 1.1.7_08, changing only the JRE to 1.1.8_09 causes this to happen
for all pulldowns.
We need patches for these this week as we freeze on 10/15 and need a final
test round.
Thanks,
Mark __ __ _ __ __
___________________________________________(__)|-< /-\(__ |__(-_
Mark V. Scardina Sr Product Mgr & XML Evangelist
CORE AND XML DEVELOPMENT GROUP E-mail: ###@###.###
John, here is a test case for the CJK bug.
import java.awt.*;
import java.awt.event.*;
class LWText extends Frame implements ActionListener {
LWText() {
super("Light Weight Text");
SimpleTextField canvas = new SimpleTextField(30,5);
add(canvas, BorderLayout.CENTER);
canvas.addActionListener(this);
pack();
show();
}
public void actionPerformed(ActionEvent e) {
System.out.println(e);
}
static public void main(String args[]) {
new LWText();
}
}
class SimpleTextField extends Component implements Runnable {
int border;
int length;
Font font;
FontMetrics fontM;
char[] buffer;
int bufferIx;
boolean hasFocus;
boolean cursorOn;
SimpleTextField(int len, int bor) {
super();
border = bor;
length = len;
buffer = new char[len];
font = getFont();
if (font == null) {
font = new Font("Dialog", Font.PLAIN, 20);
}
fontM = getFontMetrics(font);
addMouseListener(new MouseEventHandler());
addFocusListener(new FocusEventHandler());
addKeyListener(new KeyEventHandler());
setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
(new Thread(this)).start();
}
public Dimension getMinimumSize() {
int w = fontM.charWidth('m') * length;
return new Dimension(w+2*border, fontM.getHeight()+2*border);
}
public Dimension getMaximumSize() {
return new Dimension(Short.MAX_VALUE, getPreferredSize().height);
}
public Dimension getPreferredSize() {
return getMinimumSize();
}
public boolean isFocusTraversible() {
return true;
}
public void paint(Graphics g) {
int y = (getSize().height-fontM.getHeight())/2;
g.setColor(SystemColor.text);
g.fillRect(0,0,getSize().width,getSize().height);
g.setFont(font);
g.setColor(SystemColor.textText);
g.drawChars(buffer, 0, bufferIx, border, y+fontM.getAscent());
int x = fontM.charsWidth(buffer, 0, bufferIx) + border;
int w = fontM.charWidth('c');
if (hasFocus) {
g.setColor(getForeground());
if (cursorOn) {
if (bufferIx < buffer.length) {
g.setColor(Color.red); //SystemColor.text);
g.fillRect(x+2, y+2, w-3, fontM.getHeight()-4);
}
}
}
}
class MouseEventHandler extends MouseAdapter {
public void mousePressed(MouseEvent e) {
requestFocus();
}
}
class FocusEventHandler extends FocusAdapter {
public void focusGained(FocusEvent e) {
hasFocus = true;
repaint();
}
public void focusLost(FocusEvent e) {
hasFocus = false;
repaint();
}
}
class KeyEventHandler extends KeyAdapter {
public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_DELETE:
case KeyEvent.VK_BACK_SPACE:
if (bufferIx > 0) {
bufferIx--;
repaint();
}
break;
case KeyEvent.VK_ENTER:
ActionEvent action = new ActionEvent(
SimpleTextField.this,
ActionEvent.ACTION_PERFORMED,
String.valueOf(buffer, 0, bufferIx));
processEvent(action);
break;
default:
repaint();
}
}
public void keyTyped(KeyEvent e) {
if (bufferIx < buffer.length
&& !e.isActionKey()
&& !Character.isISOControl(e.getKeyChar())) {
buffer[bufferIx++] = e.getKeyChar();
}
}
}
ActionListener actionListener;
public void addActionListener(ActionListener l) {
actionListener = AWTEventMulticaster.add(actionListener, l);
}
protected void processEvent(AWTEvent e) {
if (e instanceof ActionEvent) {
processActionEvent((ActionEvent)e);
} else {
super.processEvent(e);
}
}
protected void processActionEvent(ActionEvent e) {
if (actionListener != null) {
actionListener.actionPerformed(e);
}
}
public void run() {
while (true) {
try {
Thread.sleep(500);
cursorOn = !cursorOn;
if (hasFocus) {
repaint();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
john.stampfl@eng 1999-10-07
Locale : zh, zh_TW
JDK version : 1.1.6
1) IMFTest
lightweight component :
- if there is only one Chinese character candidate for
the text you just composed. You can enter it directly.
The component will take it.
- If there are more than one Chinese charcaters to be chosen for the
thing you just composed, you select one canidate. This time the
component will not take it.
Peered Component : Pass
2) SwingSet
Same as IMFTest
3) Hjb
Same as IMFTest
- 4105612: LIGHT WEIGHT TEXTS HAVE PROBLEM INPUTTING FOR CJK CHAR SETS
which may be related to
- 4267381: Some FOCUS_LOST events were marked as Permanent, causing
problems
for lightweight components suh as Oracle's.
Bug 4105612 indicates in the description that it has been fixed but without
providing the version of the JRE.
Here are our notes:
To test the inputing problem of Chinese characters in Java lightweight text
component when there are multiple candidates, we produced two test cases:
BaliTest.java, which tests Bali LWTextField; LWText.java, which tests Java
lightweight text field. The compiler used is JDK 1.1.6, and run time
environment is JRE 1.1.8_09. Four languages have been tested: Japanese,
Traditional Chinese, Simplified Chinese and Korean, thanks to respective
testers: Peter Linsley(plinsley@us), Sapho Chang(schang@tw), Howard
Yang(hyang@cn), Bogeon Kim(bgkim@kr).
Test results for Japanese is a little different. When the window activation
policy is "Click in window to make active"(w/o workaround), sometimes users
can input the characters when there are multiple candidates. We observe the
same behavior for Japanese when testing JRE 1.1.7B, the success percentage
depends on the CPU speed. I have tried 8 times, it failed on 4th and 5th
trail. When the window activation policy is "Point in window to make
active"(w/ workaround), user can input Kanji successfully.
Test results for Traditional Chinese and Korean is the same as the testing
results for JRE 1.1.7B. That is user can NOT input Chinese Chars w/o
workaround, while the input works w/ workaround.
Test results for Simplified Chinese is the same as JRE 1.1.7B, too. User
can NOT input Chinese chars with or without workaround.
This is the second bug.
- PULL DOWN LISTS DON'T SELECT WHEN DOING A CLICK (WITH NO DRAG) AND CLICK
This bug was just found and has the following notes:
Verified that this is a JRE 1.1.8_09 bug:
Tested on a Solaris 2.6 machine which was upgraded to include all
required and recommended OS patches for JRE 1.1.8_09. Does not happen
with
JRE 1.1.7_08, changing only the JRE to 1.1.8_09 causes this to happen
for all pulldowns.
We need patches for these this week as we freeze on 10/15 and need a final
test round.
Thanks,
Mark __ __ _ __ __
___________________________________________(__)|-< /-\(__ |__(-_
Mark V. Scardina Sr Product Mgr & XML Evangelist
CORE AND XML DEVELOPMENT GROUP E-mail: ###@###.###
John, here is a test case for the CJK bug.
import java.awt.*;
import java.awt.event.*;
class LWText extends Frame implements ActionListener {
LWText() {
super("Light Weight Text");
SimpleTextField canvas = new SimpleTextField(30,5);
add(canvas, BorderLayout.CENTER);
canvas.addActionListener(this);
pack();
show();
}
public void actionPerformed(ActionEvent e) {
System.out.println(e);
}
static public void main(String args[]) {
new LWText();
}
}
class SimpleTextField extends Component implements Runnable {
int border;
int length;
Font font;
FontMetrics fontM;
char[] buffer;
int bufferIx;
boolean hasFocus;
boolean cursorOn;
SimpleTextField(int len, int bor) {
super();
border = bor;
length = len;
buffer = new char[len];
font = getFont();
if (font == null) {
font = new Font("Dialog", Font.PLAIN, 20);
}
fontM = getFontMetrics(font);
addMouseListener(new MouseEventHandler());
addFocusListener(new FocusEventHandler());
addKeyListener(new KeyEventHandler());
setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
(new Thread(this)).start();
}
public Dimension getMinimumSize() {
int w = fontM.charWidth('m') * length;
return new Dimension(w+2*border, fontM.getHeight()+2*border);
}
public Dimension getMaximumSize() {
return new Dimension(Short.MAX_VALUE, getPreferredSize().height);
}
public Dimension getPreferredSize() {
return getMinimumSize();
}
public boolean isFocusTraversible() {
return true;
}
public void paint(Graphics g) {
int y = (getSize().height-fontM.getHeight())/2;
g.setColor(SystemColor.text);
g.fillRect(0,0,getSize().width,getSize().height);
g.setFont(font);
g.setColor(SystemColor.textText);
g.drawChars(buffer, 0, bufferIx, border, y+fontM.getAscent());
int x = fontM.charsWidth(buffer, 0, bufferIx) + border;
int w = fontM.charWidth('c');
if (hasFocus) {
g.setColor(getForeground());
if (cursorOn) {
if (bufferIx < buffer.length) {
g.setColor(Color.red); //SystemColor.text);
g.fillRect(x+2, y+2, w-3, fontM.getHeight()-4);
}
}
}
}
class MouseEventHandler extends MouseAdapter {
public void mousePressed(MouseEvent e) {
requestFocus();
}
}
class FocusEventHandler extends FocusAdapter {
public void focusGained(FocusEvent e) {
hasFocus = true;
repaint();
}
public void focusLost(FocusEvent e) {
hasFocus = false;
repaint();
}
}
class KeyEventHandler extends KeyAdapter {
public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_DELETE:
case KeyEvent.VK_BACK_SPACE:
if (bufferIx > 0) {
bufferIx--;
repaint();
}
break;
case KeyEvent.VK_ENTER:
ActionEvent action = new ActionEvent(
SimpleTextField.this,
ActionEvent.ACTION_PERFORMED,
String.valueOf(buffer, 0, bufferIx));
processEvent(action);
break;
default:
repaint();
}
}
public void keyTyped(KeyEvent e) {
if (bufferIx < buffer.length
&& !e.isActionKey()
&& !Character.isISOControl(e.getKeyChar())) {
buffer[bufferIx++] = e.getKeyChar();
}
}
}
ActionListener actionListener;
public void addActionListener(ActionListener l) {
actionListener = AWTEventMulticaster.add(actionListener, l);
}
protected void processEvent(AWTEvent e) {
if (e instanceof ActionEvent) {
processActionEvent((ActionEvent)e);
} else {
super.processEvent(e);
}
}
protected void processActionEvent(ActionEvent e) {
if (actionListener != null) {
actionListener.actionPerformed(e);
}
}
public void run() {
while (true) {
try {
Thread.sleep(500);
cursorOn = !cursorOn;
if (hasFocus) {
repaint();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
john.stampfl@eng 1999-10-07
- relates to
-
JDK-4313272 11x: Chinese input does not work correctly on Solaris
- Closed