javafxports / openjdk-jfx

The openjfx repo has moved to:
https://github.com/openjdk/jfx
GNU General Public License v2.0
1.01k stars 145 forks source link

Wrong tabs order on update (TabPaneSkin bug) #619

Closed salmonb closed 4 years ago

salmonb commented 4 years ago

Here is a simple reproducer:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class TabPaneBugApplication extends Application {

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

    @Override
    public void start(Stage primaryStage) {
        Tab tab1 = new Tab("Tab 1");
        Tab tab2 = new Tab("Tab 2");
        Tab tab3 = new Tab("Tab 3");
        Tab tab4 = new Tab("Tab 4");
        TabPane tabPane = new TabPane(tab1, tab2);

        Button button = new Button();
        button.setText("Tabs 1 to 4");
        button.setOnAction(event -> tabPane.getTabs().setAll(tab1, tab2, tab3, tab4));

        StackPane root = new StackPane();
        root.getChildren().setAll(tabPane, button);
        primaryStage.setScene(new Scene(root, 300, 250));
        primaryStage.show();
    }
}

When pressing the button, the tabs order in the UI is Tab 3, Tab4, Tab 1, Tab 2 (instead of Tab 1, Tab2, Tab 3, Tab 4 as requested).

kevinrushforth commented 4 years ago

This GitHub issue tracker is not actively tracked or managed. Please file a bug at bugreport.java.com.