Java Internationalization and Localization
Exercise
You may now want to consider the following suggestions to
NEFontFactory class.
Since the font listing returns by getFontList() of IE
VM are not sorted alphabetically, as compared to
getAvailableFontFamilyNames() in Java 1.3. Therefore, we
may want to sort the result on IE VM. If we do want the code to be
internationalized, we will need to make use of the java.text.Collator
and java.util.Locale information.
Another exercise is to use Java Reflection with the following API
found in Java 1.3, where Font object is replicated with just a change of
size or style or both.
public Font deriveFont(float size)
public Font deriveFont(int style, float size)
public Font deriveFont(AffineTransform trans)
public Font deriveFont(int style, AffineTransform trans)
public Font deriveFont(int style)
public Font deriveFont(Map attributes)
Resources
The latest MS VM can be obtained from Microsoft's Java site.
MS Java SDK
References on I18N and Java
- ONJava.com
- IBM developerworks Internationalization theme page
- alphaWorks Technologies by IBM
- http://www.javasoft.com/
- JavaWorld.com
- Unicode home page
- W3C
Summary
In this article, we illustrated how to achieve the display of
Asian characters in applets on IE by using Java Reflection. Otherwise,
these texts would have appeared in "block" characters. We also
illustrated how to obtain a listing of user system fonts depending on
which version of VM you are using.
This technique has been implemented in our client-side Java-based
product, Facado, which in
addition to being internationalized, offers interactive and
collaborative computing capabilities in the browser.
I welcome your feedback and exchange of ideas. Contact me via email.
Acknowledgement
I would like to thank Steve Anglin, Managing Editor of ONJava.com, for giving me this
opportunity to share this information with you and NexusEdge
Technologies Pte Ltd for providing the environment to develop
leading-edge Java solutions.
I would like to thank my colleague, Thierry Bedos, for his valuable
discussion on Java reflection and feedback on this article.
Jaric Sng
is a Java GUI designer and developer with interest and expertise with Java Internationalization.
Return to ONJava.com.