masayoshi.okutsu@Eng 1997-01-06
On Japanese Win95, TextArea.insert*/append*/replace* operations corrupt
Japanese text. The following test program reproduces the problem.
import java.awt.* ;
public class test extends java.applet.Applet {
Frame window ;
public void init() {
window = new MyFrame("test case of java.awt.ScrollPane") ;
window.resize(850,450) ;
window.show() ;
}
}
class MyFrame extends Frame {
TextArea ta1 ;
TextArea ta2 ;
int buttonDown=0 ;
MyFrame(String title) {
super(title) ;
ta1 = new TextArea("\u30c6\u30b9\u30c8\u3060\u3088\u30fc\u3093") ;
add(ta1) ;
ta2 = new TextArea("\u30c6\u30b9\u30c8\u3060\u3088\u30fc\u3093") ;
add(ta2) ;
Button bt = new Button(" \u6b21 \u3078 ") ;
add(bt) ;
setLayout(new FlowLayout(FlowLayout.CENTER)) ;
}
public boolean action(Event evt, Object arg) {
if (evt.target instanceof Button) {
String label = (String) arg ;
if (label.equals(" \u6b21 \u3078 ")) {
nextAction() ;
}
}
return true ;
}
public void nextAction () {
switch (buttonDown) {
case 0 :
ta1.appendText(" test dayo-n") ;
ta2.insertText("test dayo-n ",0) ;
break ;
case 1 :
ta1.append(" \u30c6\u30b9\u30c8 \u3060\u3088\u30fc\u3093") ;
ta2.insert("\u30c6\u30b9\u30c8 \u3060\u3088\u30fc\u3093 ",0) ;
break ;
case 2 :
ta1.append(" test dayo-n") ;
ta2.insert("test dayo-n ",10) ;
break ;
case 3 :
ta1.appendText(" \u30c6\u30b9\u30c8 \u3060\u3088\u30fc\u3093") ;
ta2.insertText("\u30c6\u30b9\u30c8 \u3060\u3088\u30fc\u3093 ",23) ;
break ;
default :
buttonDown-- ;
}
buttonDown++ ;
}
}