• Post Reply Bookmark Topic Watch Topic
  • New Topic

printing extended characters in swing  RSS feed

 
Ansh Bhai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I posted this earlier in Java General forum :-(
But let me be more specific this time...
Is there any way I can on a JLabel print a "tm" (trademark) symbol from extended character set/extended ascii ?
Thanks in advance.
 
Ansh Bhai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
of course this could apply to any other character as well...I just wanna know how would one approach this problem. Do I have to play with fonts? UIManager? Unicode?
 
Ansh Bhai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
calling java experts...last call!
 
John Dale
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are covered by the default fonts, at least on Windows, since the TM character, Unicode 0x2122, is Latin-1 Windows code page.

(Edit for code layout.)
[ June 18, 2002: Message edited by: John Dale ]
 
John Dale
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A few additional remarks on how to approach the problem.
1) Find the Unicode value of the character you are after.
a) The general way to do this is to use thecode chart at www.unicode.org.
b) If you are running a Unicode version of Windows (e.g., NT, 2000, but I don't know about 9x,ME), you can use the Windows character map utility. What characters you can see depends on what font you select (and what Windows language support you have installed), but the fonts witih unicode in the name tend to show more symbols. If using Windows NT, betware that the code in the "Windows" sections are not necessarily Unicode (usually CP1252 instead); you want codes are start with, as I recall, "U+" (which you will write as \u in Java.
2) For a character to display, you must use the right code and use a configured in your Java runtime and installed in your operating system that contains a glyph for that character. The easy way is to just try it an see what happens. The Windows character mapper will allow you to see what is installed on your system. The jre/lib/font.properties file will let you see what is installed in your Java environment. The Java internationalization documentation will help you understand the font.properties.
(3) Beware of the US English Only version of the Java runtime from Sun. It does not include the i18n.jar file, and has limited character support. I think all the developer environments I've seen, the "all language" runtime environments from Sun, and all runtime environments from IBM have i18n.jar. (But I've never looked at the 1.0.x, pre 1.1.6, and Win16 stuff.)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!