indiWiz.com

Subhash's Tech Log

“Hello World” (GUI) example in JavaFX

without comments

package tutorial;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;

def WIDTH = 160;
def HEIGHT = 80;
def MESSAGE = "Hello World!";

Stage {
    title: MESSAGE
    width: WIDTH
    height: HEIGHT
    scene: Scene {
        fill: Color.BLACK
        content:
            Text {
                font: Font.font("Serif", FontWeight.BOLD, 16)
                fill: Color.WHITE
                x: 10
                y: 30
                content: MESSAGE
            }
    }
}

Written by Subhash Chandran

June 8th, 2009 at 8:39 am

Posted in Java

Tagged with

Leave a Reply