UNICODE PROBLEM WITJAVA.AWT.LIST

P

phil89

HI

I have an old project hat use AWT and some component hat use
java.awt.list.
Non i need to add Unicode characters into theses list \u015F.
It seems me that java.awt.List don't support unicode ?
Could you confirm me ?

Regards
Philippe
 
R

Roedy Green

I have an old project hat use AWT and some component hat use
java.awt.list.
Non i need to add Unicode characters into theses list \u015F.
It seems me that java.awt.List don't support unicode ?
Could you confirm me ?

see the setFont method. What chars are supported depend on the font
chosen. See http://mindprod.com/applet/fontshowerawt.html
--
Roedy Green Canadian Mind Products
http://mindprod.com
Your old road is
Rapidly agin'.
Please get out of the new one
If you can't lend your hand
For the times they are a-changin'.
 
P

phil89

Hi,

I could see caracater into an TextField, but not into java.awt.List

Regards
Philippe
 
P

phil89

Hi Roedy,

I could see turkish caracter like \015f witrh your tool.
I think problem is only with java.awt.List

Regards
Philippe
 
P

phil89

Hi Roedy


I have lake an little Applet. I could not see \u015F caracter with
java.awt.List.

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"; //test caractere TURC
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);
}
}
 
A

Andrew Thompson

Hi Roedy

I have lake an little Applet. I could not see \u015F caracter with
java.awt.List.

For the little that it is worth, I observed
the same basic behavior you describe. The
character showed in the TextArea, but not
the List, with a variety of the basic Font
types.

One possible fix is to exchange the List for
a (shock horror) javax.swing.JList. This
might work OK - *IF* the GUI does not have
items which might overlap the JList, notably
menus or tooltips.

It is a bit of a kludge, but it might work for
a temporary fix.

Have you checked the bug database? If it is
a bug, I suspect Sun's motivation to fix it
will be low. Their concentration on server
side Java, with the rest of most of their
interest focused on new classes (like
Desktop) and Swing components, would leave
very little time for them to look at
problems with AWT components (I suspect).

Or perhaps it is time to update the entire
application to Swing.

Out of curiosity. What does the app. do?
(If it is not a state secret.)
<half in cheek>
Is it something that could even be done
as a web interface?
</half in cheek>
 
P

phil89

Hi,


With this applet Customer could create their own screen and add
component.

Regards
Philippe
 
P

phil89

Hi,

Sorry, That's ok when i launch from an Application but not from an
Applet.
My Applet is an signed applet
System.setProperty("file.encoding","UTF-8")

Regards
 
R

Roedy Green

I could see caracater into an TextField, but not into java.awt.List

same font?
--
Roedy Green Canadian Mind Products
http://mindprod.com
"Humanity is conducting an unintended, uncontrolled, globally pervasive experiment
whose ultimate consequences could be second only to global nuclear war."
~ Environment Canada (The Canadian equivalent of the EPA on global warming)
 
R

Roedy Green

I could see turkish caracter like \015f witrh your tool.
I think problem is only with java.awt.List

It may be with AWT. See http://mindprod.com/applet/fontshowerawt.html
for AWT.

If you use a canvas you can use a broader set of fonts. If you use
Components you are limited to the logical fonts.


and http://mindprod.com/applet/fontshower.html for swing
--
Roedy Green Canadian Mind Products
http://mindprod.com
"Humanity is conducting an unintended, uncontrolled, globally pervasive experiment
whose ultimate consequences could be second only to global nuclear war."
~ Environment Canada (The Canadian equivalent of the EPA on global warming)
 
R

Roedy Green

SansSerif = new Font ("Dialog", Font.BOLD, 14);
SansSerif = new Font ("Arial", Font.BOLD, 14);

You can't use Arial in AWT, only the logical fonts. See
http://mindprod.com/jgloss/logicalfonts.html

Use Swing and JList to get at all the fonts.
--
Roedy Green Canadian Mind Products
http://mindprod.com
"Humanity is conducting an unintended, uncontrolled, globally pervasive experiment
whose ultimate consequences could be second only to global nuclear war."
~ Environment Canada (The Canadian equivalent of the EPA on global warming)
 
R

Roedy Green

Sorry, That's ok when i launch from an Application but not from an
Applet.
My Applet is an signed applet
System.setProperty("file.encoding","UTF-8")

Try it. The worst that could happen is your code would be ignored.
--
Roedy Green Canadian Mind Products
http://mindprod.com
"Humanity is conducting an unintended, uncontrolled, globally pervasive experiment
whose ultimate consequences could be second only to global nuclear war."
~ Environment Canada (The Canadian equivalent of the EPA on global warming)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,619
Members
45,312
Latest member
Svsdvsdvs

Latest Threads

Top