[java] Unicode

Started by
4 comments, last by RayNbow 18 years, 2 months ago
Heya people, Does anyone know how to make JButtons with Unicode text labels. My initial approach was; String unicodeMessage = "\u7686\u3055"; EditDone = new JButton( unicodeMessage ); Which just prints out squares (because their not printable characters). Thanx, Daed. [Edited by - Daedalus AI on February 6, 2006 4:24:52 AM]
Advertisement
Um, if they're not printable characters... what exactly did you expect to see?
Quote:Original post by Metaphorically
Um, if they're not printable characters... what exactly did you expect to see?


Um, I think his point is that they are Unicode characters that should render, yet the Java UI is not doing it...
I'm not sure, but this link may help you.
If they're printable and not being printed then I'd see if there's an appropriate font to render them. Conversely, you could try the same notation to specify a couple characters that you know are available (like something from the ascii range).
The following code works just fine here.
JFrame jf = new JFrame("Test");jf.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);JButton jb = new JButton("\u7686\u3055");jf.getContentPane().add(jb);jf.pack();jf.setVisible(true);

So like Metaphorically said, check if you have fonts that are able to render your Japanese text (mina kanji + sa hiragana, right?).

This topic is closed to new replies.

Advertisement