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

[Dialog] Using ButtonBar.BUTTON_ORDER_NONE leads to IllegalStateException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u40
    • Fix Version/s: 8u40
    • Component/s: javafx
    • Labels:
      None
    • Environment:

      Win7 x86

      Description

      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)
      ...

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported: