4 Replies Latest reply: Jun 20, 2014 5:39 AM by Eric Le Ponner RSS

    Error during rezising SplitPane (build with Scenebuilder)

    Olek

      Hi,

       

      I created a little app with the Scenebuilder and Netbeans.

      Here is the main class:

       

      public class MainApp extends Application {
      
       @Override
       public void start(Stage stage) throws Exception {
       Parent root = FXMLLoader.load(getClass().getResource("/fxml/Scene.fxml"));
       
       Scene scene = new Scene(root);
       scene.getStylesheets().add("/styles/Styles.css");
       
       stage.setTitle("JavaFX and Maven");
       stage.setScene(scene);
       stage.show();
       }
      

      Here is the generated FXML code

      <?xml version="1.0" encoding="UTF-8"?>
      
      <?import javafx.geometry.*?>
      <?import java.lang.*?>
      <?import java.util.*?>
      <?import javafx.scene.*?>
      <?import javafx.scene.control.*?>
      <?import javafx.scene.layout.*?>
      
      
      <BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
       <center>
       <SplitPane dividerPositions="0.5" prefHeight="160.0" prefWidth="200.0" BorderPane.alignment="CENTER">
       <items>
       <BorderPane prefHeight="200.0" prefWidth="200.0">
       <top>
       <ToolBar prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
       <items>
       <Label text="Show">
       <padding>
       <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
       </padding>
       </Label>
       <SplitMenuButton mnemonicParsing="false" text="Everything">
       <items>
       <MenuItem mnemonicParsing="false" text="Hardware" />
       <MenuItem mnemonicParsing="false" text="Software" />
       </items>
       </SplitMenuButton>
       </items>
       </ToolBar>
       </top>
       <center>
       <ScrollPane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
       </center>
       </BorderPane>
       <BorderPane prefHeight="200.0" prefWidth="200.0">
       <top>
       <ToolBar prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
       </top>
       <center>
       <ScrollPane fitToHeight="true" fitToWidth="true" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
       <content>
       <TableView editable="true">
       <columns>
       <TableColumn prefWidth="75.0" text="C1" />
       <TableColumn prefWidth="75.0" text="C2" />
       </columns>
       </TableView>
       </content>
       </ScrollPane>
       </center>
       </BorderPane>
       </items>
       </SplitPane>
       </center>
       <top>
       <HBox prefHeight="100.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
       </top>
      </BorderPane>
      
      
      

       

      If I run this on my machine (Fedora20(KDE) Linux, Java8u5 64bit, Scenebuilder 2)

      I get an error when I do the following:

      First press with mouse on the choice button but don't select an item.

      Then drag the divider of the splitpane to the left.

      The choice button is removed and I get this :

       

      Exception in thread "JavaFX Application Thread" java.lang.ArrayIndexOutOfBoundsException: -1
       at java.util.ArrayList.elementData(ArrayList.java:403)
       at java.util.ArrayList.get(ArrayList.java:416)
       at com.sun.javafx.scene.control.skin.ToolBarSkin.addNodesToToolBar(ToolBarSkin.java:459)
       at com.sun.javafx.scene.control.skin.ToolBarSkin.layoutChildren(ToolBarSkin.java:319)
       at javafx.scene.control.Control.layoutChildren(Control.java:574)
       at javafx.scene.Parent.layout(Parent.java:1076)
       at javafx.scene.Parent.layout(Parent.java:1082)
       at javafx.scene.Parent.layout(Parent.java:1082)
       at javafx.scene.Parent.layout(Parent.java:1082)
       at javafx.scene.Parent.layout(Parent.java:1082)
       at javafx.scene.Scene.doLayoutPass(Scene.java:576)
       at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2386)
       at com.sun.javafx.tk.Toolkit$3.run(Toolkit.java:322)
       at com.sun.javafx.tk.Toolkit$3.run(Toolkit.java:320)
       at java.security.AccessController.doPrivileged(Native Method)
       at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:320)
       at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:349)
       at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:479)
       at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:460)
       at com.sun.javafx.tk.quantum.QuantumToolkit$13.run(QuantumToolkit.java:327)
       at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
       at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
       at com.sun.glass.ui.gtk.GtkApplication.access$200(GtkApplication.java:48)
       at com.sun.glass.ui.gtk.GtkApplication$6$1.run(GtkApplication.java:149)
      

       

      I think this is a bug isn't it?

       

      Regards,

       

      Olek