FXML
Eintrag zuletzt aktualisiert am: 09.05.2016
F
XML ist die
XML-basierte Oberflächenbeschreibungssprache in
JavaFX seit Version 2.0, vergleichbar mit
XAML in
WPF und Silverlight.
Hello World in F
XML
<?import javafx.scene.control.
Label?>
<
Label text="Hallo Welt!"/>
Zweites Beispiel
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import fxml.MyGroup?>
<Gruppe xmlns:fx="
http://javafx.com/fxml"> <children>
<
Button text="Klick mich" onAction="#handle
ButtonAction" />
<
Label fx:id="label" translateX="0" translateY="30" text=""/>
</children>
</Gruppe >
package fxml;
import java.net.
URL;
import java.util.Map;
import javafx.event.ActionEvent;
import javafx.fxml.Bindable;
import javafx.fxml.F
XML;
import javafx.fxml.Resources;
import javafx.scene.Group;
import javafx.scene.control.
Label;
public class Gruppe extends Group implements Bindable{
@F
XML private
Label label;
@F
XML private void handle
ButtonAction(ActionEvent event) {
label.setText("Hallo Welt!");
}
public void initialize(Map<String, Object> namespace,
URL location, Resources resources) {
}
}