javafx sdk on linux
I wanted to give the java fx sdk preview a try and got a bit confused, because there where no downloads for linux.
so i downloaded the macos version without netbeans (the zip file - not the dmg), unpacked it and set some environment variables (JAVAFX_HOME and JFX_HOME pointing to wherever you unpacked the zip file) - and TADA! A working javafx environment even under linux
if you write the code from below into a file called Hello.fx and compile it using
javafxc -d . Hello.fx
and run it using
javafx Hello
This should result in something like this
import javafx.scene.*;
import javafx.scene.paint.*;
import javafx.scene.geometry.*;
import javafx.scene.text.*;
import javafx.scene.effect.*;
import javafx.scene.effect.light.*;
import javafx.ext.swing.*;
SwingFrame {
title: "Hallo Welt"
width: 310
height: 98
content: Canvas {
content: Group {
content: [
Rectangle {
x: 10
y: 10
width: 280
height: 50
arcWidth: 15
arcHeight: 15
fill: Color.web("#C0C0C0")
effect: Lighting {
light: DistantLight {
azimuth: 225
}
}
},
Text {
x: 150
y: 40
content: "Hello World!"
font: Font {
name: "Serif"
size: 20
style: FontStyle.BOLD
}
fill: Color.WHITE
horizontalAlignment: HorizontalAlignment.CENTER
}
]
}
}
visible: true
}
read more ...