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

[Tab] Unable to set tooltip for tab more than once.

    Details

      Description

      To reproduce:
      1. Run app.
      2. Move mouse to one of the tabs and wait until tooltip pops up.
      3. Press button "Set new tooltip".
      4. Repeat step 2.
      5. Nothing has changed.

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.geometry.Side;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.Tab;
      import javafx.scene.control.TabPane;
      import javafx.scene.control.Tooltip;
      import javafx.scene.layout.HBox;
      import javafx.stage.Stage;

      public class JavaApplication29 extends Application
      {

          TabPane myPane;

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

          @Override
          public void start(Stage stage) throws Exception
          {
              HBox root = new HBox(10d);

              myPane = new TabPane();
              myPane.setTranslateX(200);
              myPane.setTranslateY(150);
              myPane.setPrefSize(200, 200);
              myPane.setSide(Side.TOP);

              for (int i = 0; i < 5; i++) {
                  Tab tab = new Tab("Tab " + i);
                  tab.setTooltip(new Tooltip("Tooltip #" + i));
                  myPane.getTabs().add(tab);
              }

              root.getChildren().add(myPane);

              Button btnResetToolTip = new Button("Set new tooltip");
              btnResetToolTip.setOnAction(new EventHandler<ActionEvent>() {

                  @Override
                  public void handle(ActionEvent t)
                  {
                      for (int i = 0; i < myPane.getTabs().size(); i++) {
                          myPane.getTabs().get(i).setTooltip(new Tooltip("New Tooltip #" + i));
                          
                      }
                  }
              });
              
              root.getChildren().add(btnResetToolTip);
              
              Scene scene = new Scene(root, 600, 400);
              stage.setScene(scene);
              stage.show();
          }
      }

        Attachments

          Activity

            People

            • Assignee:
              psomashe Parvathi Somashekar (Inactive)
              Reporter:
              dzinkevi Dmitry Zinkevich (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved:
                Imported: