Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8093300

[SpltPane] Cannot set divider position in multiple splitpanes at once under certain conditions



    • Bug
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • None
    • 8u40
    • javafx


      From Mike Richardsson:
      We noticed in our application that the problem is not fixed. We have more levels of nested split panes than the original example...

      Here is the original example modified to show this issue still requires some work. Notice if you press the Adjust button the dividers are being set on each occasion. The problem seems to occur when we add tables to each split pane (which our application does)

      package application;

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.geometry.Insets;
      import javafx.geometry.Orientation;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.Label;
      import javafx.scene.control.SplitPane;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.scene.layout.AnchorPane;
      import javafx.scene.layout.VBox;
      import javafx.scene.text.Font;
      import javafx.stage.Stage;

      public class JavaFXTest extends Application {
          public void start(Stage primaryStage) {
              AnchorPane ap = new AnchorPane();
              VBox base = new VBox();
              Button b = new Button("Adjust");

             SplitPane sp = new SplitPane();
             SplitPane sp2 = new SplitPane();
             SplitPane sp4 = new SplitPane();
             SplitPane sp3 = new SplitPane();
             sp4.getItems().addAll(createTableBox(), createTableBox());
             sp3.getItems().addAll(sp4, createTableBox());
             sp2.getItems().add(0, sp3);
             sp2.getItems().add(1, createTableBox());
             sp.getItems().add(0, sp2);
             sp.getItems().add(1, createTableBox());
             ap.setPrefSize(1000, 600);
             sp.setPrefSize(1000, 600);
              AnchorPane.setTopAnchor(base, 0.0);
              AnchorPane.setBottomAnchor(base, 0.0);
              AnchorPane.setLeftAnchor(base, 0.0);
              AnchorPane.setRightAnchor(base, 0.0);

             b.setOnAction(new EventHandler<ActionEvent>() {

                  public void handle(ActionEvent event) {
                      //-> this is when the stage should adjust all three SplitPanes at once
                       // but only does one at a time
              Scene scene = new Scene(ap, 1000, 600);


          private VBox createTableBox() {
           TableView table = new TableView();

                TableColumn firstNameCol = new TableColumn("First Name");
                TableColumn lastNameCol = new TableColumn("Last Name");
                TableColumn emailCol = new TableColumn("Email");
                table.getColumns().addAll(firstNameCol, lastNameCol, emailCol);
                final VBox vbox = new VBox();
                vbox.setPadding(new Insets(10, 0, 0, 10));
                final Label label = new Label("Address Book");
                label.setFont(new Font("Arial", 20));
                vbox.getChildren().addAll(label, table);
                return vbox;
          public static void main(String[] args) {


        Issue Links



              msladecek Martin Sládeček
              msladecek Martin Sládeček
              0 Vote for this issue
              2 Start watching this issue