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

[TabPane] The tab disappeared after the index changed

    XMLWordPrintable

    Details

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

      window8.1 pro, java 64-bit build 1.8.0_20-b26

      Description

      When change the tab index, it will impact the other tab(s) and not show again[8u11 can work but NOT 8u20]. Please see the below code:

      import java.util.concurrent.Executors;
      import java.util.concurrent.TimeUnit;

      import javafx.application.Application;
      import javafx.application.Platform;
      import javafx.scene.Scene;
      import javafx.scene.control.Tab;
      import javafx.scene.control.TabPane;
      import javafx.stage.Stage;

      public class TabIndexChangeTest extends Application {

      public static void main(String[] args) {
      launch(args);
      }

      @Override
      public void start(Stage stage) throws Exception {

      TabPane tp = new TabPane();
      tp.getTabs().addAll(new Tab("Tab 1"), new Tab("Tab 2"));

      Scene scene = new Scene(tp, 600, 200);
      stage.setScene(scene);
      stage.setTitle("Change Tab Index Test");
      stage.show();

      Executors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(() -> {
      Platform.runLater(() -> {
      Tab tab0 = tp.getTabs().get(0);
      tp.getTabs().remove(0);
      tp.getTabs().add(tab0);
      });

      }, 5, 5, TimeUnit.SECONDS);

      }

      }

        Attachments

          Activity

            People

            Assignee:
            msladecek Martin Sládeček
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: