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

[TabPane] The tab disappeared after the index changed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u40
    • 8u20
    • javafx
    • window8.1 pro, java 64-bit build 1.8.0_20-b26

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

      }

      }

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

              Created:
              Updated:
              Resolved:
              Imported: