introduction-to-java-fx-8-slides
introduction-to-java-fx-8-slides
José Paumard
blog.paumard.org
@JosePaumard
Module Outline
Layout
Module Outline
Layout
Layout
Layout
Layout
stage.setScene(new Scene(message));
stage.setTitle("Hello");
stage.show();
}
A Few Key Concepts
On our example:
stage.setScene(new Scene(vbox));
stage.setTitle("Hello");
stage.show();
}
A Login Window Example – XML Version
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
</GridPane>
A Login Window Example – XML Version
<padding>
<Insets bottom="10.0" top="10.0"
left="10.0" right="10.0" />
</padding>
<children>
<!‐‐ children components ‐‐>
</children>
</GridPane>
A Login Window Example – XML Version
<children>
<Label text="User name:" />
<TextField fx:id="username"/>
</children>
<HBox >
<children>
<Button text="Ok" onAction="#okAction"/>
</children>
</HBox>
<!‐‐ rest of the UI ‐‐>
</GridPane>
A Login Window Example – XML Version
@FXML
private TextField username;
@Override
public void initialize(URL url, ResourceBundle bundle) {
}
System.out.println("Clicked ok");
System.out.println("user name = " +
username.getText());
}
}
A Login Window Example – XML Version
Supports CSS for customizing the look and feel of the GUI