Thursday March 26, 2009 A community member has launched a new Japanese JavaFX user community portal, javafx.jp. I am so happy to see that the community members are active in promoting JavaFX technology! As a localization PM, I am always looking for such communities in various languages. If you know of such JavaFX community, please send me the URL. Thanks in advance!
Posted by naoko ( Mar 26 2009, 04:03:43 PM PDT ) Permalink Comments [0]
Friday March 06, 2009 If you go to javafx.com, you will notice that there is a language selection menu in the footer now. When you click on the [Change] link, you will see the following language selection menu.

We are going global little by little. The Simplified Chinese content is still a bit out of date, but we have plans to fix that. As a JavaFX localization PM, it is very rewarding to see the contents in multiple languages. We hope to add more contents and languages, so stay tuned.
Posted by naoko ( Mar 06 2009, 03:01:22 PM PST ) Permalink Comments [0]
Friday February 27, 2009 I do a lot of testing under various configurations, and one of the testings that I had to perform today required Japanese Windows XP environment.
I decided to use my own Windows laptop, which has Windows XP in English installed.
I know that Windows allows you to change the language in which the UI components are displayed (and I have done it before at work), so I was looking for a way to do that. Looks like you can do it by changing the Language used in menus and dialogs option. This article explains the steps very well.
So I tried to do the same on my system, BUT there is no such option on my system. I logged out and logged back in, rebooted the system, etc. No luck. What the heck?
It turns out that this feature is only available on Windows XP Professional Edition. The version that I have is Windows XP Home Edition, so this feature is disabled. Oh boy, no wonder I could not get it to work at home, but it was working fine elsewhere. Just FYI, you can find out the version of your OS by running the winmsd command at the command-line prompt. You will see something like the following with a lot of information about your system.
Wednesday February 25, 2009 We now have a JavaFX forum in Simplified Chinese! Thanks to my colleague May for setting it up. You can also access it from the SDN China main page.
Unfortunately, I cannot read Chinese, but hopefully this will help the Chinese community adopt the technology even more!
Posted by naoko ( Feb 25 2009, 02:08:40 PM PST ) Permalink Comments [0]
Friday February 20, 2009 I came to know about JFXStudio today. It's where people can post their own JavaFX creations. More details on Joshua Marinacci's Blog, the creator of the site. Looks very cool!
Posted by naoko ( Feb 20 2009, 02:59:20 PM PST ) Permalink Comments [0]
Thursday February 19, 2009 You may already know about this. Jim Weaver and Sang Shin are offering a Free 15-Week JavaFX Programming (with Passion!) Online Course. It started on January 30, 2009. Currently, we are in week three.
I have been studying JavaFX in my spare time. So far, the course has been great. It provides links to a lot of useful documents to read, and labs contain a bunch of samples that we can actually run in NetBeans to play around with. At the end of each session, there is some homework that we do and submit, to make sure that we understood what we learned.
As a newbie to JavaFX, I always feel that "it's so easy to do this in Java. How can I do the same in JavaFX?" Hopefully with time and this course, things will change for me!
Posted by naoko ( Feb 19 2009, 01:24:32 PM PST ) Permalink Comments [0]
Thursday February 12, 2009 JavaFX.com is all new! JavaFX 1.1 is released late last night, which features JavaFX Mobile. Check it out.
Also - my blog is introduced on the new JavaFX.com site, under Explore. This is exciting! Now hopefully more people learn about the internationalization features in JavaFX and start using them in their applications. Please report any issues you find, it will help us improve!
Adding the image here before it goes away... 

Wednesday February 04, 2009 Someone asked me to write step-by-step instructions on how to internationalize a JavaFX sample using NetBeans IDE, so I decided to also post it here.
For this exercise, we are going to use Fading Transparent Window sample, as it is simple and it has some text in it. Most of the samples are very visual, and there are no messages to localize.
Setup
1. We will use NetBeans, so download NetBeans 6.5 with JavaFX support from here. Follow the instructions to install it on your system.
2. Let's grab the source code for Fading Transparent Window. Click on Download Source Code button to download the zip file. Extract the zip file into a directory of your choice. It contains a NetBeans project called TransparentWindow.
3. Open this project in NetBeans.

4. Now run it. You can simply click on the green triangle at the top. Move the mouse cursor in and out of the application see the visual effect.


Internationalization
OK, time to internationalize this application. I have outlined the steps required to internationalize a JavaFX application in my previous entry, JavaFX Localization. Steps are almost identical here, except that in this scenario, we will programmatically set the default locale to Japanese per the requester.
1. Change the application to use string literal translation notation.
You can either embed it or declare it as a variable.
Embedded:
====================================================

====================================================
Declared:
====================================================

====================================================
2. Let's create Main_ja.fxproperties. Place this file in the same directory as Main.fx in the NetBeans project.

3. The application should run just fine in a Japanese environment now, but since I am testing it on a system with English locale set as default, I am going to programmatically set my default locale to Japanese.
====================================================

====================================================
Of course we can also simply do
====================================================

====================================================
but I wanted to show the other way just in case if the locale of your choice is not defined in the Locale class.
4. Now it's all set, ready to be run. Simply click on the triangle to execute it.


That's it. Very simple and straight forward!
Posted by naoko ( Feb 04 2009, 04:33:13 PM PST ) Permalink Comments [2]
Friday January 30, 2009 I am very proud and happy to announce that now, you no longer have to remember all the local JavaFX sites' links. They are all linked off of the English site.
For JavaFX on SDN, go here. You see in the upper right hand corner a box with links to the contents in Simplified Chinese, Japanese and Russian.
For javafx.com, go here. You can see a link to the Simplified Chinese version of javafx.com at the bottom of the page.
This is something that I was directly involved with as a JavaFX Localization PM, so it's very nice to see it in action. There is also a nice blurb on the SDN site, under "What's New" section. This is cool! I cut and pasted it here since it will disappear soon as more news come along.

Tuesday January 13, 2009 I know Java input method has been around for quite some time, but I have never really had a chance to play with it until now. Our JavaFX i18n team is working on implementing the on-the-spot input method feature for JavaFX (not yet released) so I am working on familiarizing myself with this technology. I am writing this entry more for myself and my team, but hopefully other readers will also find it useful.
I am focusing on Windows and Mac platforms now, as these are the currently supported platforms for JavaFX.
So what is Java input method? It's all described here: Using Input Methods on the JavaTM Platform.
Let's use City Input Method as an example for testing.
Windows Platform
1. Download City Input Method jar file from here.
2. Copy the jar file into the extension directory.
# cp CityIM.jar <JDK_HOME>/jre/lib/ext
Note: Make sure to copy it to jre/lib/ext, not lib/ext!
3. Write a Swing-based application (I just grabbed this source file but any Swing-based application with text component should do).
4. Compile and Run.
# javac CelsiusConverterGUI.java
# java CelsiusConverterGUI
5. Click on the System menu and now we should see a new menu item, called "Select Input Method".
Mac Platform
1. Download City Input Method jar file from here.
2. Copy the jar file into the extension directory.
# cp CityIM.jar /Library/Java/Extensions
3. Write a Swing-based application (I just grabbed this source file but any Swing-based application with text component should do).
4. Enable Java input method.
This step is different from Windows platform. We need to use an alternative method of selecting an input method by pressing a user-defined hot key. We need to configure it first.
# cd /Applications/Utilities/Java
# open -a "Input Method Hotkey.app"
This brings up the following window, where we can specify the hot key for Java input method. I am going to use Ctrl-a.

5. Compile and Run.
# javac CelsiusConverterGUI.java
# java CelsiusConverterGUI
6. Hit Ctrl-a when the focus is on the application, and we should see the input method selection window popping up, as below.

Pretty neat!
Posted by naoko ( Jan 13 2009, 02:27:39 PM PST ) Permalink Comments [0]
Monday January 12, 2009 One of my responsibilities at work is to manage the localization of JavaFX documents into different languages. I am excited to announce that some of the JavaFX documents are now available in Simplified Chinese, Japanese and Russian! The Russian localization was done by volunteers (Sun employees) in Saint-Petersburg. Many thanks to Irina and her team for going an extra mile to get this done! These pages contain very useful tutorials, where to go to download and get help, etc.
Here are the links:
Simplified Chinese: JavaFX at developers.sun.com.cn
Japanese: JavaFX at sdc.sun.co.jp
Russian: JavaFX at developers.sun.ru
We also have javafx.com localized into Simplified Chinese by SDN China. It is available here: javafx.com in Simplified Chinese
Enjoy, and please give us feedback!
Posted by naoko
( Jan 12 2009, 10:55:13 AM PST )
Permalink
Comments [0]
Friday December 19, 2008 So far, I have always used the default search mechanism to locate fxproperties file - JavaFX script picks up the fxproperties file that has the same name as the script itself and also locates in the same directory as the script itself.
Sometimes we may want to specify which fxproperties file to associate with the script. In this blog, I explain how to programatically accomplish it.
Turns out there is an easy and simple way to do it.
All we need is the following API.
============================================== package: javafx.util.StringLocalizer public associate(properties: java.lang.String, packageName: java.lang.String) : Void public associate(properties: java.lang.String, packageName: java.lang.String, scriptFileName: java.lang.String) : Void ==============================================
The first associate function allows me to specify an fxproperties file for all the scripts in a package, and the second associate function allows me to specify an fxproperties file for a particular script in a package.
So let's see it in action.
Here is my directory structure.
============================================== /home/naoko/myPackage test.fx (this file has package declaration at the top of the file) /home/naoko/myPackage/resources myResources_ja.fxproperties ==============================================
In test.fx, I add the following line.
==============================================
StringLocalizer.associate("myPackage.resources.myResources", "myPackage");
==============================================
Then I compile and execute it.
============================================== # /home/naoko/myPackage/javafxc test.fx # cd .. # /home/naoko/javafx myPackage.test ==============================================
It should be picking up the strings from myResources_ja.fxproperties file.
Note: Make sure to include this line BEFORE you use ## to define strings to be translated.
The API doc explains this function as well as dissociate function very well. http://java.sun.com/javafx/1/docs/api/javafx.util/javafx.util.StringLocalizer.html
I had a difficult time at first, because I initially tried to use the class loader to load the fxproperties file (just like how we can do it in Java). I guess that approach does not work with JavaFX. Learning something new everyday!
Posted by naoko
( Dec 19 2008, 03:45:55 PM PST )
Permalink
Comments [1]
Thursday December 18, 2008 Many thanks to my dear colleague, May Zhang, now the JavaFX Localization entires are available in Simplified Chinese! Yay!
JavaFX Localization Part 1 (Simplified Chinese)
JavaFX Localization Part 2 (Simplified Chinese)
Posted by naoko ( Dec 18 2008, 02:10:23 PM PST ) Permalink
Monday December 15, 2008 In my previous posting, I had some problems with the rendered fonts. In this posting, I explain a couple of different ways to fix the problem.
1. Set Font Type in JavaFX Script
Instead of relying on the default, I explicitly specify the font type.
Replace
===================================================
SwingLabel {height: 30 width: 250 text: v1},
SwingLabel {height: 30 width: 250 text: v2},
SwingLabel {height: 30 width: 250 text: v3},
SwingButton {height: 30 width: 250 text: v4},
SwingButton {height: 30 width: 250 text: v5}
===================================================
with
===================================================
SwingLabel {height: 30 width: 250 text: v1 font: Font{name: "MS Gothic", size: 20}},
SwingLabel {height: 30 width: 250 text: v2 font: Font{name: "MS Gothic", size: 20}},
SwingLabel {height: 30 width: 250 text: v3 font: Font{name: "MS Gothic", size: 20}},
SwingButton {height: 30 width: 250 text: v4 font: Font{name: "MS Gothic", size: 20}},
SwingButton {height: 30 width: 250 text: v5 font: Font{name: "MS Gothic", size: 20}}
===================================================
Let me also make the fonts a little bigger. Now it looks a lot better.
However, this approach makes the script no longer universal - different font types will be required for different locales. Here is another (and better) way to fix this problem - thanks to Naoto-san for his help!
2. Set Look and Feel to System Default in JavaFX Script
Here, I specify Look and Feel (aka LAF) to the system default in the script. I am testing on Mac OSX. The default LAF used is javax.swing.plaf.metal.MetalLookAndFeel. For Mac OSX, it is better if I use its own LAF: apple.laf.AquaLookAndFeel. In any case, the following snippet does the trick for any OS.
=================================================== var dLAF = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(dLAF); ===================================================
Oh don't forget to import the UIManager class. Also don't forget to remove the hardcoded font declarations from the script.
=================================================== import javax.swing.UIManager; ===================================================
Now when I execute it, this is what I get.
Oh this looks so much nicer!
FYI - a bug has been for this issue, see this: Swing based FX apps look worse comparing to the Swing native apps on MacOSX. Please vote if you think it should be fixed!
Posted by naoko
( Dec 15 2008, 12:50:37 PM PST )
Permalink
Comments [0]
Friday December 12, 2008
JavaFX localization is easy and simple. If you know Java, it's very similar, but even better
Here I am going to walk you through some basic steps required to localize a very simple JavaFX application.
1. Create an application.
Here is my simple JavaFX GUI application in English. Note that the messages are externalized.
=================================================== import javafx.stage.Stage; import javafx.scene.*; import javafx.scene.text.Font;
import javafx.ext.swing.*; import javafx.scene.layout.VBox; var v1 = ##"My Label"; var v2 = ##"Your Label"; var v3 = ##"Our Label"; var v4 = ##"Hello Button"; var v5 = ##"Goodbye Button"; Stage { title: "JavaFX Localization Test" width: 300 height: 300 visible: true scene: Scene { content: VBox { spacing:5 content: [ SwingLabel {height: 30 width: 250 text: v1}, SwingLabel {height: 30 width: 250 text: v2}, SwingLabel {height: 30 width: 250 text: v3}, SwingButton {height: 30 width: 250 text: v4}, SwingButton {height: 30 width: 250 text: v5} ] } } } ===================================================
2. Compile and execute it.
# javafxc test.fx # javafx test
OK, everything looks good so far.
3. Create an fxproperty file.
Let's localize the strings. Here you can see my test_ja.fxproperties. Note that I can embed Japanese characters directly in the file - no more encrypted escape sequences!
=================================================== "My Label" = "私のラベル" "Your Label" = "あなたのラベル" "Our Label" = "私たちのラベル" "Hello Button" = "こんにちはボタン" "Goodbye Button" = "さようならボタン" ===================================================
4. Execute it.
Wow, the application is already localized! However, the fonts are kind of ugly here...
I will cover how I can fix this problem in my next blog. Stay tuned
Posted by naoko
( Dec 12 2008, 05:30:45 PM PST )
Permalink
Comments [6]
| « November 2009 | ||||||
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | |||||
| Today | ||||||
Today's Page Hits: 26