5 Replies Latest reply on Nov 27, 2012 4:57 PM by edward17

    Tooltip Hell

      Ok, I am in the bowels of TooTip Hell.

      Scenario One:
      I have a large window. On top of that is another window, a smaller window. So the user is using the top window. They want it to be the top window. They are happy on top.

      Mouse cursor slips over to bottom window. They slip it back and are happy because they are still on top.

      The mouse cursor slips again. This time when the cursor moves over the bottom window, it happens on a field with a tooltip. Before they can move the cursor back, the tooltip pops up, brings the bottom window to the top with it, and pushes the smaller window to the bottom. The user is unhappy.

      Scenario Two:
      I have a large window. The user hovers over a save button. They click Save. A dialog pops up confirming their data is safe. parent.getScene().getRoot().setEffect(new BoxBlur()); ias executed to obscur the parent window isnce this dialog is MODAL. The user selects OK, the dialog closes, and the parent window is readable again.

      Happy with their experience, the user does some more work, they drag the mouse cursor to the Save button again. However, they are tired, so they are moving slower, and happen to linger a little too long on another control along the way. They trigger a tooltip, but before it is rendered, they make it to the save button and click it. The dialog box confirming their save pops up, and the parent is blurred. Then the tooltip of the parent pops up, pushes the modal dialog to the back. Now the user has a tooltip on a blurred window on top, and a modal dialog they can't proceed without somewhere in their deep stack of many open windows. They curse my name and cease to buy my product, because it is so unprofessional.

      Suggestions? Guess I am looking for a way to insure a tooltip doesn't chnage the top to bottom order of my windows under ANY circumstances.
        • 1. Re: Tooltip Hell
          One solution is to create your own tooltip skin (or node subclass) which does not use a popup window.

          Make the parent of the Pane having the tooltip overlaid a StackPane, place your main content on the bottom of the stack and the tooltip content (when needed) layering over the base content when you hover.

          Here is some sample code I used for something similar before (in this case it was a document modal dialog box for a web browser, but it should also work for a custom tooltip with some adjustment):
             * Overlay a dialog on top of the webview.
             * @param dialogNode the dialog to overlay on top of the view.
            private void overlayView(Node dialogNode) {
              // if the view is already overlaid we will just ignore this overlay call silently . . . todo probably not the best thing to do, but ok for now.
              if (!(getView().getParent() instanceof BorderPane)) return;
              // record the view's parent.
              BorderPane viewParent = (BorderPane) getView().getParent();
              // create an overlayPane layering the popup on top of the webview
              StackPane overlayPane = new StackPane();
              overlayPane.getChildren().addAll(getView(), new Group(dialogNode));
              // overlay the popup on the webview.
            private void removeViewOverlay() {
              BorderPane viewParent = (BorderPane) getView().getParent().getParent();
          There may be some other solution if you want to use the standard Tooltip class with it's popup window, but I don't know what that is.
          • 2. Re: Tooltip Hell
            I present to you a workaround worthy of our Neanderthal ancestors.
            final TextField field = new TextField();
            final Tooltip tip = new Tooltip("Bothersome tooltip");
            field.setOnMouseEntered(new EventHandler<MouseEvent>()
                 public void handle(MouseEvent evt)
                      if (stage.isFocused())
            Clunky as hell, but it works =P
            • 3. Re: Tooltip Hell
              I also have had issues with tooltip, many months ago. Problems occured when you have multiple monitors and when you try to popup the toolitip manually..I do not know whether this issues have been fixed meanwhile, anyway I decided to create my own tooltip at that time and since then I never ever had problems again.
              • 4. Re: Tooltip Hell
                I had a look at the ToolTop code on openjdkjfx

                Is there a way to determine if a window is on top? If so I could clone the existing code, make minor change, and all would be well.
                • 5. Re: Tooltip Hell
                  OK, wow, never expected this.

                  I had NOT been assigning owner windows to my dialogs. Once I did my tooltip Hell evaporated in a puff of sulfurous smoke!!!!


                  truly all the problems went away with this one change! Hurrah!!!