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

Alert disables Tab selection when TabDragPolicy REORDER is used

    XMLWordPrintable

Details

    • b09
    • x86_64
    • windows_10

    Backports

      Description

        A DESCRIPTION OF THE PROBLEM :
        If we set TabDragPolicy to REORDER, when attempting to display an alert message when a tab is selected, the tabs freeze. We are no longer able to select the tabs. The rest of the UI is responsive however.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Set TabPane TabDragPolicy to REORDER.

        Add two tabs inside a TabPane.
        Add a ChangeListener to selectionProperty of each tab.
        Inside the change listener, display a simple alert message.

        Initially first tab is selected (by default) and alert message is displayed.
        Select second tab. Alert message is displayed.
        Select first tab again. Alert message is displayed.
        Try to select second tab again.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Second tab gets selected and alert message is displayed.
        ACTUAL -
        Second tab does not select.

        ---------- BEGIN SOURCE ----------
        public class Controller {

            @FXML private TabPane tabPane;

            @FXML
            public void initialize() {
                tabPane.setTabDragPolicy(TabPane.TabDragPolicy.REORDER);

                for (int i = 0; i < 2; i++) {
                    Tab tab = new Tab("Untitled Tab " + (i + 1));
                    tab.setClosable(true);

                    tab.selectedProperty().addListener((obs, oldVal, newVal) -> {
                        if (newVal) {
                            Platform.runLater(() -> {
                                Alert alert = new Alert(Alert.AlertType.INFORMATION, "Hello World!");
                                alert.showAndWait();
                            });
                        }
                    });
                    tabPane.getTabs().add(tab);
                }
            }

        }
        ---------- END SOURCE ----------

        FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

                jvos Johan Vos
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: