| # GUI Commands User Guide ## Version 2.1 |
| # Hovering Since it's such a common practice to provide user feedback when the mouse hovers over a button or menu, a simple `HoverListener` is available to facilitate this task. The HoverListener interface defines two methods that notify you when the mouse enters and leaves a command generated button, menu or hyperlink. HoverListeners are registered with the HoverManager for events that occur within a specific window. The following is a typical case where the long-description attribute can be used to provide a more detailed description of the command.
       HoverManager manager = GuiCommands.getHoverManagerFor(window);

       manager.addHoverListener(new HoverListener()
       {
          public void hoverStarted(HoverEvent event)
          {
             String text = event.getFace().getLongDescription();
             if (text == null)
             {
                text = event.getFace().getDescription();
             }
             statusBar.setText(text);
          }

          public void hoverEnded(HoverEvent e)
          {
             statusBar.setText("");
          }
       });
You can also add hover listeners directly to commands and groups, but you'll need to check the source component to ensure the relevance of the hover event. |