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

[Dialog] Using ButtonBar.BUTTON_ORDER_NONE leads to IllegalStateException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u40
    • 8u40
    • javafx
    • None
    • Win7 x86

      I wanted to redefine the button order of the ButtonBar used in a DialogPane to be the order in which the ButtonTypes are added to the DialogPane. The documentation of ButtonBar.BUTTON_ORDER_NONE suggests, that this would do the trick, so I tried:

      DialogPane dialogPane = new DialogPane() {
          @Override
          protected Node createButtonBar() {
              ButtonBar bar = (ButtonBar)super.createButtonBar();
              bar.setButtonOrder(ButtonBar.BUTTON_ORDER_NONE);
              return bar;
          }
      };
      dialogPane.getButtonTypes().add(ButtonType.FINISH);
      dialogPane.getButtonTypes().add(ButtonType.CLOSE);
      dialogPane.setContent(createContent());

      This leads to an exception:
      Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException: ButtonBar buttonOrder string can not be null or empty
      at com.sun.javafx.scene.control.skin.ButtonBarSkin.layoutButtons(ButtonBarSkin.java:142)
      at com.sun.javafx.scene.control.skin.ButtonBarSkin.<init>(ButtonBarSkin.java:99)
      at javafx.scene.control.ButtonBar.createDefaultSkin(ButtonBar.java:518)
      ...

            jgiles Jonathan Giles
            ckeimeljfx Christoph Keimel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: