It’s fun to learn new languages and althrough I prefer Actionscript 3 I’m giving JavaFX a shot because it’s been developerd by sun the guys that brought us JAVA. Ive heard of the ten minute JavaFX tutorial. This will be like a three minute tutorial. This screenshot gives an idea of how simple this will be:

See, it says “Hello World” in the viewport, and “Hello World” in the window frame. Bellow is the code that makes this happen.
package HelloWorld;
/*Import all of the packages we'll be using. */
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
/*The stage is the window. */
Stage {
title: "Hello World"
width: 250
height: 80
/*The scene is the viewport. The stage has a variable named scene that is Scene object. */
scene: Scene {
/* The scene has some content inside it, in this case is will be the "Hello World" text.*/
content: [
/* When you're programming be prepared to think of everything. We need to program our text by giving it a size and a family*/
Text {
font : Font {
name: "Sans Serif"
size : 16
}
/*Here is where we answer the question of where we want to place the text we've just created in the viewport in number of pixels*/
x: 10
y: 30
/*The content of our text box will be some text right.*/
content: "Hello World"
}/*end text*/
]/*end scene content*/
}/*end scene*/
}/*end Stage*/








Leave a Comment