Thursday, 11 February 2010

JavaFX HelloWorld

Hi everybody!
As I mentioned couple days before I bought the book about JavaFX. Yes, I started reading it and coding. The syntax is completely different from the languages that I learnt so far, therefore it takes me a bit of time to get used to it.

I would like to share my first Hello World application:


And here is the javaFX code for this:

import javafx.stage.Stage;
import javafx.scene.*;
import javafx.scene.paint.Color;
import javafx.scene.text.*;
import javafx.stage.StageStyle;

var helloWorld: Text;

Stage {
    title: "Helo world"
    width: 200
    height: 200
    resizable: false
    style: StageStyle.DECORATED
    scene: Scene {
        fill: Color.ORANGE
        content: [
            helloWorld = Text {
                layoutY: 80
                layoutX: 20
                fill: Color.BLACK
                font: Font.font("Serif", FontWeight.BOLD, 20);
                content: "HELLO WORLD"
            }
        ]
    }
}


Enjoy!

Cheers

No comments:

Post a Comment