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

TabPane doesn't respect order of TabPane.getTabs() list

XMLWordPrintable

    • x86_64
    • windows_7

      ADDITIONAL SYSTEM INFORMATION :
      C:\Users\hwaite>ver

      Microsoft Windows [Version 6.1.7601]

      C:\Users\hwaite>java -version
      java version "1.8.0_192"
      Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      TabPane.getTabs().setAll(permutatedTabs) fails to reorder tabs. Thus, it's not possible to permutate TabPane.getTabs() in a single call. ListChangeListener should do more than just reset Tab's TabPane reference. This should probably mimic TableView/TableColumn behavior.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run application and press 'Swap' button.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Tabs switch places.
      ACTUAL -
      Nothing happens.

      ---------- BEGIN SOURCE ----------
      public class Test extends Application {
        public static void main(String[] pArgs) {launch(pArgs);}

        @Override public void start(Stage pStage) throws IOException {
          final Tab tabA = new Tab("Alpha", new Label("Alpha"));
          final Tab tabB = new Tab("Bravo", new Label("Bravo"));
          final TabPane tabPane = new TabPane(tabA, tabB);

          final Button btn = new Button("Swap");
          btn.setOnAction(
            pEvt -> {
              tabPane.getTabs().setAll(
                tabPane.getTabs().get(1), tabPane.getTabs().get(0)
              );
            }
          );

          pStage.setScene(new Scene(new VBox(tabPane, btn), 850, 400));
          pStage.show();
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Remove and re-add tabs in separate calls.

      FREQUENCY : always


            arapte Ambarish Rapte
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: