Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

UNICODE TURKISH CARACTER PROBLEM ON AWT.LIST

843807Nov 24 2008 — edited Nov 24 2008
Hi

I have an project that use Java.awt.List into an Applet.
I need to deploy this project into turkish, but i have problem with Turkish caracter.
I have made an little program where i could reproduce problem



Regards
Philippe


import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;


public class List2 extends Applet implements ItemListener {
/* Declaration */
private LayoutManager Layout;
private List Selector;
private Font SansSerif;


public List2 () {
/* Declaration */
String [] ColorList;
int i;


/* Instantiation */
ColorList = new String [9];
// SansSerif = new Font ("SansSerif", Font.BOLD, 14);
SansSerif = new Font ("Dialog", Font.BOLD, 14);
SansSerif = new Font ("Arial", Font.BOLD, 14);
Layout = new FlowLayout ();
Selector = new List ();


/* Decoration */
ColorList [0] = "Red";
ColorList [1] = "Magenta";
ColorList [2] = "Blue";
ColorList [3] = "Cyan";
ColorList [4] = "Green";
ColorList [5] = "Yellow";
ColorList [6] = "White";
ColorList [7] = "Gray";
ColorList [8] = "Bla\u015fck"; //BAD Turkish
for (i = 0; i < ColorList.length; ++i) {
Selector.add (ColorList );
}
Selector.setBackground (Color.yellow);
Selector.setForeground (Color.red);
Selector.setFont (SansSerif);


/* Location */
setLayout (Layout);
add (Selector);


/* Configuration */
Selector.addItemListener (this);


/* Initialization */
Selector.select (5);
setBackground (Color.yellow);
}


public void itemStateChanged(ItemEvent e) {
int Selection;
Selection = Selector.getSelectedIndex();
if (Selection == 0) {
setBackground (Color.red);
} else if (Selection == 1) {
setBackground (Color.magenta);
} else if (Selection == 2) {
setBackground (Color.blue);
} else if (Selection == 3) {
setBackground (Color.cyan);
} else if (Selection == 4) {
setBackground (Color.green);
} else if (Selection == 5) {
setBackground (Color.yellow);
} else if (Selection == 6) {
setBackground (Color.white);
} else if (Selection == 7) {
setBackground (Color.gray);
} else if (Selection == 8) {
setBackground (Color.black);
}
}


public static void main(String[] args) {
List2 applet = new List2();
Frame frame = new Frame();
frame.addWindowListener(new WindowAdapter() { public void
windowClosing(WindowEvent e) { System.exit(0); } } );
frame.add(applet, BorderLayout.CENTER);
frame.setTitle( "Applet Frame" );
applet.init();
applet.start();
frame.setSize(300, 300);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
frame.setLocation((d.width-frameSize.width)/2, (d.height-
frameSize.height)/2);
frame.setVisible(true);
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2008
Added on Nov 24 2008
2 comments
152 views