Class HoverTracker
- java.lang.Object
-
- com.inductiveautomation.ignition.client.util.HoverTracker
-
public class HoverTracker extends java.lang.Object
This class is an overly complex way to do something that you think should be simple. It calls callbacks when the mouse hovers over a component and another when it exits. This could be done easily with aMouseListener
but unfortunately that strategy only works for simple components with no children. This implementation puts mouse listeners on the given component and all children, and tracks whenever the mouse is anywhere in the interior of the outermost component. Note that the tracker does not handle the case where the children are altered after the tracker is created, so make the tracker after the UI has been initialized.
-
-
Constructor Summary
Constructors Constructor Description HoverTracker(javax.swing.JComponent component, java.lang.Runnable onEnter, java.lang.Runnable onExit)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HoverTracker
installHoverBackground(javax.swing.JComponent component, java.awt.Color normalColor, java.awt.Color hoverColor)
static HoverTracker
installHoverBorder(javax.swing.JComponent component, javax.swing.border.Border normalBorder, javax.swing.border.Border hoverBorder)
void
uninstall()
Removes the mouse listeners from all the components they were installed on.
-
-
-
Method Detail
-
installHoverBackground
public static HoverTracker installHoverBackground(javax.swing.JComponent component, java.awt.Color normalColor, java.awt.Color hoverColor)
-
installHoverBorder
public static HoverTracker installHoverBorder(javax.swing.JComponent component, javax.swing.border.Border normalBorder, javax.swing.border.Border hoverBorder)
-
uninstall
public void uninstall()
Removes the mouse listeners from all the components they were installed on.
-
-