JavaFX Experiments

Note: Upload to public_html/wp-content/blogs.dir/4/files/javafx

#1

Cheat sheets

FXML

((Scene)FXMLLoader.load(getClass().getResource("fxml_tableview.fxml"))

// to get controller
FXMLLoader loader = new FXMLLoader(getClass().getResource("fxml_tableview.fxml"));
(Scene) loader.load();
(MyController) loader.getController();

Stylesheets

JavaFX Stylesheets have to be set programmatically, not declaratively.

scene.getStylesheets().add("/resources/shell.css");

ItemsSource binding

ListView has an ObservableList itemsProperty whereupon invalidated() calls

if (getSkin() instanceof ListViewSkin) {
  ListViewSkin<?> skin = (ListViewSkin<?>) getSkin();
  skin.updateListViewItems();
}