Kenji Tachibana's Weblog

« JavaFX ランタイムローカリゼーショ... | メイン | 翻訳: Konichiwa JavaFX »

http://blogs.sun.com/kenji/date/20090401 2009年 4月 01日 水曜日

JavaFX: Display localized Screen on runtime

This is English version of this blog



JavaFX.COM has many interesting samples for JavaFX. I was asked JavaFX sample team, to create a sample for changing the display language on runtime. So, I've created it and up it on my blog, first.

Sample for Runtime localization (Web Start, use signed jar)

If you see the source code, you can find that this example is using the Locale.setDefault Java class method, like change the default locale and reload the localized strings from .fxproperties.

The clock in botton of the screen is created with refering to Building a JavaFX Application Using NetBeans IDE .
However, to display the time, use extended formatter to display localized time format.


LocalizedDate = "{%tEc now}";

"now" is the Date Object from Java class, and put the localized time strings to LocalizedDate (String).
This time is displayed in each timezone's time. So, please compare the English (Los Angeles) and Japanese (Tokyo).

Also, this sample has the round image animation (?), which is I've wanted to create from before. When you click the language button, world map will move to center the city where represent specified language and Timezone.
- English : Los Angeles
- Japanese: Tokyo
- Simplified Chinese: Shanghai (Because timezone need to specify Shanghai (not Beijing) in Java)
- Korean: Seoul
- Brazilian Portuguese: Sao Paulo

This is simply implemented with 3 lined world map, and display only center one and move 3 maps together to left or right.

Source Code






Displayed in English. Then, click Japanese (日本語) button,

Chnage to Japanese.

投稿されたコメント:

コメント
コメントは無効になっています。

Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.