The newly released version of Sun's JavaFx also comes with a Linux version. Even it's still a beta version I decided to try it on the EEEPC 900
Why JavaFx on EEEPC?
I know that EEEPC is not the best choice for programming because of the small keyboard, the small screen and so on ... but the high portability of EEEPCgives you an ever-ready programming environment good for little experiments and for just having some fun programming.
Java SDK update
I first downloaded from Sun site the latest Jdk version, JavaFx requires at least 1.6.14 version while the currently installed version on EEEPC was 1.6.10.
I extracted Jdk files by executing its installation file
chmod a+x jdk-6u14-linux-i586.bin sudo mv jdk-6u14-linux-i586.bin /opt
sudo /opt/jdk-6u14-linux-i586.bin
then I configured the newly installed Java as default virtual machine by first adding it to the udate alternatives list (the whole command goes in a single line)
sudo update-alternatives --install /usr/bin/java javaI at last selected the just installed Jdk as the default one using the command
/opt/jdk1.6.0_14/bin/java 30
sudo update-alternatives --config java
Netbeans Configuration
I then configured Netbeans by editing its configuration file and replacing old JDK path with the new one
sudo gedit /opt/netbeans-6.5/etc/netbeans.conf
...
# Default location of JDK, can be overridden by using --jdkhome <dir>:
netbeans_jdkhome="/opt/jdk1.6.0_14/"
...
I finally launched Netbeans to verify it was working with the correct Jdk.
Installing JavaFx Plugins
After verifying Netbeans was working proprly and letting it download the lastest updates selected from Netbeans plugins window the three JavaFx plugins.
After plugins installation completed, and Netbeans IDE restarted, I've been able to start a new JavaFx project. Here is my first JavaFx script
and here is the result (just another "hello world" program)./*
* Main.fx
*
* Created on 16-giu-2009, 7.34.18
*/
package demofx;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;
import javafx.scene.paint.Color;
/**
* @author maxx
*/
Stage {title: "Application title"width: 350height: 100scene: Scene {fill:LinearGradient {startX : 0.0startY : 0.0endX : 1.0endY : 0.0stops: [Stop {color : Color.BISQUEoffset: 0.0},
Stop {color : Color.BLUEoffset: 1.0},
]
}
content: [Text {font : Font {size : 56embolden: true}
x: 10y: 50content: "Hello World"fill: Color.BLACK}
Text {font : Font {size : 56embolden: true}
x: 15y: 55content: "Hello World"fill: Color.BLACKopacity: 0.5}
]
}
}
(syntax highlighted by Code2HTML, v. 0.9.1)
No comments :
Post a Comment