The following code does not work after recent changes:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.stage.Stage;
public class Test extends Application {
public static void main(String[] args) {
Application.launch(args);
}
public void start(Stage stage) {
TreeItem<String> root = new TreeItem<String>();
add(root, "first"); // works
TreeView<String> view = new TreeView<String>(root);
view.setShowRoot(false);
add(root, "second"); // fails
stage.setScene(new Scene(view));
stage.setVisible(true);
}
private static void add(TreeItem<String> parent, String child) {
parent.getChildren().add(new TreeItem<String>(child));
}
}
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.stage.Stage;
public class Test extends Application {
public static void main(String[] args) {
Application.launch(args);
}
public void start(Stage stage) {
TreeItem<String> root = new TreeItem<String>();
add(root, "first"); // works
TreeView<String> view = new TreeView<String>(root);
view.setShowRoot(false);
add(root, "second"); // fails
stage.setScene(new Scene(view));
stage.setVisible(true);
}
private static void add(TreeItem<String> parent, String child) {
parent.getChildren().add(new TreeItem<String>(child));
}
}