|
|
|
1000 Java Tips ebook
|
|
 

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java
programming articles and tips. Please take your copy here.
Take your copy of free "Java Technology Screensaver"!. |
|
Easy Learn Java: Programming Articles, Examples and Tips - Page 76
Previous
1060 Stories (530 Pages, 2 Per Page)
Next
I want to get the java.lang.String to read a stream of Chinese characters. But I
|
Question: I want to get the
java.lang.String to read a stream of Chinese
characters. But I am getting only rubbish characters.
How can I make my program language independent?
Answer: You
need to have 3 elements:
1. A font.properties file
2. Fonts
3. Swing/AWT components
Add your new font (Chinese) to font.properties file.
Remember that AWT components are limited to displaying characters
defined in the host's default code page. For example on an English
OS, it is code page 1252.
Until you change a default code page you can not display text
properly in a Frame title, a TextArea, or a TextField. If you
change it the rest of the system will not be possible to use
The solution is to use only Swing components.
Java 2 allows you to load any font and you will not be limited by
fonts that are defined in font.properties file.
11 comments | | Score: 4.5
|
Posted by jalex on Monday, September 01, 2003 (00:00:00) (4787 reads)
|
|
|