Package com.formdev.flatlaf
Class SubMenuUsabilityHelper
- java.lang.Object
-
- com.formdev.flatlaf.SubMenuUsabilityHelper
-
- All Implemented Interfaces:
java.util.EventListener,javax.swing.event.ChangeListener
class SubMenuUsabilityHelper extends java.lang.Object implements javax.swing.event.ChangeListenerImproves usability of submenus by using a safe triangle to avoid that the submenu closes while the user moves the mouse to it.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classSubMenuUsabilityHelper.SafeTrianglePainterprivate classSubMenuUsabilityHelper.SubMenuEventQueue
-
Field Summary
Fields Modifier and Type Field Description private booleanchangePendingprivate booleaneventQueuePushNotSupportedprivate static SubMenuUsabilityHelperinstanceprivate java.awt.RectangleinvokerBoundsprivate static java.lang.StringKEY_SHOW_SAFE_TRIANGLEprivate static java.lang.StringKEY_USE_SAFE_TRIANGLEprivate intmouseXprivate intmouseYprivate SubMenuUsabilityHelper.SafeTrianglePaintersafeTrianglePainterprivate SubMenuUsabilityHelper.SubMenuEventQueuesubMenuEventQueueprivate inttargetBottomYprivate inttargetTopYprivate inttargetX
-
Constructor Summary
Constructors Constructor Description SubMenuUsabilityHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.awt.PolygoncreateSafeTriangle()private intfindSubMenu(javax.swing.MenuElement[] path)(package private) static booleaninstall()private voidmenuSelectionChanged()voidstateChanged(javax.swing.event.ChangeEvent e)(package private) static voiduninstall()private voiduninstallEventQueue()
-
-
-
Field Detail
-
KEY_USE_SAFE_TRIANGLE
private static final java.lang.String KEY_USE_SAFE_TRIANGLE
- See Also:
- Constant Field Values
-
KEY_SHOW_SAFE_TRIANGLE
private static final java.lang.String KEY_SHOW_SAFE_TRIANGLE
- See Also:
- Constant Field Values
-
instance
private static SubMenuUsabilityHelper instance
-
eventQueuePushNotSupported
private boolean eventQueuePushNotSupported
-
subMenuEventQueue
private SubMenuUsabilityHelper.SubMenuEventQueue subMenuEventQueue
-
safeTrianglePainter
private SubMenuUsabilityHelper.SafeTrianglePainter safeTrianglePainter
-
changePending
private boolean changePending
-
mouseX
private int mouseX
-
mouseY
private int mouseY
-
targetX
private int targetX
-
targetTopY
private int targetTopY
-
targetBottomY
private int targetBottomY
-
invokerBounds
private java.awt.Rectangle invokerBounds
-
-
Method Detail
-
install
static boolean install()
-
uninstall
static void uninstall()
-
stateChanged
public void stateChanged(javax.swing.event.ChangeEvent e)
- Specified by:
stateChangedin interfacejavax.swing.event.ChangeListener
-
menuSelectionChanged
private void menuSelectionChanged()
-
uninstallEventQueue
private void uninstallEventQueue()
-
findSubMenu
private int findSubMenu(javax.swing.MenuElement[] path)
-
createSafeTriangle
private java.awt.Polygon createSafeTriangle()
-
-