import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.SplitPane; import javafx.scene.control.TextField; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Stage; /** * A test for split pane moving to the left throws an exception * java.lang.IllegalArgumentException: Both width and height must be >= 0 * * @author cdea */ public class SplitPaneWithTextfield extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { Application.launch(args); } @Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 380, 118, Color.WHITE); // Left and right split pane SplitPane splitPane = new SplitPane(); splitPane.prefWidthProperty().bind(scene.widthProperty()); splitPane.prefHeightProperty().bind(scene.heightProperty()); VBox leftArea = new VBox(10); leftArea.getChildren().add(new TextField()); VBox rightArea = new VBox(10); splitPane.getItems().addAll(leftArea, rightArea); HBox hbox = new HBox(); hbox.getChildren().add(splitPane); root.getChildren().add(hbox); primaryStage.setScene(scene); primaryStage.show(); } }