package javafxsamples; import javafx.application.Application; import javafx.builders.SplitPaneBuilder; import javafx.scene.Scene; import javafx.scene.control.SplitPane; import javafx.scene.control.TextBox; import javafx.stage.Stage; /** * * @author Alex */ public class SplitPaneTest extends Application { SplitPane splitPane; TextBox box1 = new TextBox(); TextBox box2 = new TextBox(); void init1() { SplitPane.Divider divider = new SplitPane.Divider(); divider.setPosition(.4); splitPane = new SplitPaneBuilder() .items(box1, box2) .dividers(divider) .build(); } void init2() { splitPane = new SplitPane(); splitPane.getItems().addAll(box1, box2); splitPane.setDividerPosition(0, .4); } @Override public void start(Stage primaryStage) throws Exception { // init1(); init2(); primaryStage.setScene(new Scene(splitPane, 200, 100)); primaryStage.setVisible(true); } public static void main(String[] args) { launch(args); } }