-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
05
-
sparc
-
solaris_8
Name: pa48320 Date: 04/25/2002
cannot display Thai characters on Solaris
When running the test program shown below, JRE 1.3.x cannot
display Thai characters on Solaris. JRE 1.4 doesn't have
this problem, but we need the fix for JRE 1.3.1_xx for Solaris.
Solaris: JRE 1.3.x cannot display Thai characters.
JRE 1.4 doesn't have this problem.
Windows: doesn't have this problem.
------------------------------------------------------------
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Locale;
public class ThaiTest {
public ThaiTest() {
Frame frame = new ThaiTestFrame();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
frame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.setVisible(true);
}
public static void main(String[] args) {
new ThaiTest();
}
}
class ThaiTestFrame extends JFrame {
public ThaiTestFrame() {
super();
try {
thaiTestFrameInit();
} catch(Exception e) {
e.printStackTrace();
}
}
private void thaiTestFrameInit() throws Exception {
this.setSize(new Dimension(900, 670));
this.setTitle(System.getProperty("java.version")
+ " " + System.getProperty("os.name")
+ " " + System.getProperty("os.arch")
+ " " + System.getProperty("os.version")
+ " " + Locale.getDefault().toString()
+ " " + System.getProperty("file.encoding"));
String fontName[] = {"dialog", "dialoginput",
"serif", "sansserif", "monospaced"};
int fontStyle[] = {Font.PLAIN, Font.BOLD,
Font.ITALIC, Font.BOLD | Font.ITALIC};
String fontStyleName[] = {"plain", "bold",
"italic", "bold + italic"};
String text;
if (System.getProperty("os.name").equals("SunOS")) {
if (Locale.getDefault().getLanguage().equals("th")) {
text = "\u0e42\u0e17\u0e23\u0e28\u0e31\u0e1e\u0e17"
+ "\u0e4c\u0e21\u0e37\u0e2d\u0e16\u0e37\u0e2d";
} else {
text = "Please test with LANG=th";
}
} else {
text = "Please test on Solaris";
}
int y = 10;
JLabel jLabel;
for (int n = 0; n < fontName.length; n++) {
for (int s = 0; s < fontStyle.length; s++) {
jLabel = new JLabel();
jLabel.setFont(new Font(fontName[n], fontStyle[s], 22));
jLabel.setText(fontName[n] + " " + fontStyleName[s] + " : "
+ text);
jLabel.setBounds(50, y, 800, 26);
this.getContentPane().add(jLabel);
y += 26;
}
y += 18;
}
y += 26;
jLabel = new JLabel();
jLabel.setText(" ");
jLabel.setBounds(50, y, 800, 26);
this.getContentPane().add(jLabel);
}
}
------------------------------------------------------------
(Review ID: 145855)
======================================================================