GUI Commands User GuideVersion 2.1 |
||
HoveringSince it's such a common practice to provide user feedback when the mouse hovers over a button or
menu, a simple 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. |
||