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

[windows] Tooltip changes a nodes cursor back to default on first appearance

XMLWordPrintable

    • x86_64
    • windows

      FULL PRODUCT VERSION :
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 x64

      A DESCRIPTION OF THE PROBLEM :
      Cursor on a Node is set manually (e.g. Cursor.HAND on an HBox). The node also has a Tooltip added by Tooltip.install(). The first time the Tooltip appears, it changes the cursor back to default.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Create a Node with some content (e.g. an HBox with a Label in it)
      - Set that node's cursor to something else (e.g. Cursor.HAND)
      - Add a tooltip with Tooltip.install(node, tooltip)

      When the mouse moves over the node, the cursor changes to the hand (correct).
      After short delay, the tooltip appears (also correct) and the cursor changes to default (incorrect)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The cursor should remain as a hand all the time, while the mouse is hovering over the X.
      ACTUAL -
      The cursor will change to default the first time the tooltip appears.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.geometry.Pos;
      import javafx.scene.Cursor;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.Label;
      import javafx.scene.control.Tooltip;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.layout.GridPane;
      import javafx.scene.layout.HBox;
      import javafx.stage.Stage;

      /**
       * Demonstration of cursor changing to default when tooltip appears.
       * Mouse over the text to see the issue, use the button to create more nodes and recreate the issue without restarting the application
       */
      public class TooltipIssueDemo extends Application {

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

        int count = 0;

        @Override
        public void start(Stage primaryStage) {
          GridPane root = new GridPane();
          root.setHgap(5.0);
          Button button = new Button("New Node");
          BorderPane.setAlignment(button, Pos.CENTER_RIGHT);
          root.add(createBox(), count++, 0);
          root.add(button, 0, 1);
          button.setOnAction(event -> {
            root.add(createBox(), count++, 0);
          });
          Scene scene = new Scene(root, 450, 150);
          primaryStage.setScene(scene);
          primaryStage.show();
        }

        private HBox createBox() {
          HBox box = new HBox();
          Label label = new Label("Mouse here");
          box.getChildren().add(label);
          box.setCursor(Cursor.HAND);
          Tooltip.install(box, new Tooltip("Tooltip on node"));
          return box;
        }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: