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

Removing second-last item from SplitPane produces NullPointerException in layout

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: fx2.0
    • Component/s: javafx

      Description

      Removing the second-last item from a SplitPane produces this exception:

      java.lang.NullPointerException
      at com.sun.javafx.scene.control.skin.SplitPaneSkin.updateDividerPos(SplitPaneSkin.java:281)
      at com.sun.javafx.scene.control.skin.SplitPaneSkin.layoutChildren(SplitPaneSkin.java:681)
      at javafx.scene.Parent.layout(Parent.java:880)
      at javafx.scene.Scene.layoutDirtyRoots(Scene.java:421)
      at javafx.scene.Scene.doLayoutPass(Scene.java:394)
      at javafx.scene.Scene.access$2800(Scene.java:121)
      at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:1687)
      at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:279)
      at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:395)
      at com.sun.javafx.tk.quantum.QuantumToolkit$10.run(QuantumToolkit.java:328)

      Test program (click on the window to provoke the bug):

      public class DeleteMe extends Application {
          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage stage) throws Exception {
              final SplitPane pane = SplitPaneBuilder.create().build();
              Group g1 = new Group();
              final Group g2 = new Group();
              pane.getItems().addAll(g1, g2);
              Scene scene = SceneBuilder.create().height(400).width(400).root(pane).build();
              StageBuilder.create().scene(scene).visible(true).applyTo(stage);
              pane.setOnMouseClicked(new EventHandler<MouseEvent>() {
                  @Override public void handle(MouseEvent event) {
                      pane.getItems().remove(g2);
                  }
              });
          }
      }

        Attachments

          Activity

            People

            • Assignee:
              kwwong Kinsley Wong
              Reporter:
              emcmanuswse Eamonn McManus (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: