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.ChangeListener
Improves 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 class
SubMenuUsabilityHelper.SafeTrianglePainter
private class
SubMenuUsabilityHelper.SubMenuEventQueue
-
Field Summary
Fields Modifier and Type Field Description private boolean
changePending
private boolean
eventQueuePushNotSupported
private static SubMenuUsabilityHelper
instance
private java.awt.Rectangle
invokerBounds
private static java.lang.String
KEY_SHOW_SAFE_TRIANGLE
private static java.lang.String
KEY_USE_SAFE_TRIANGLE
private int
mouseX
private int
mouseY
private SubMenuUsabilityHelper.SafeTrianglePainter
safeTrianglePainter
private SubMenuUsabilityHelper.SubMenuEventQueue
subMenuEventQueue
private int
targetBottomY
private int
targetTopY
private int
targetX
-
Constructor Summary
Constructors Constructor Description SubMenuUsabilityHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.awt.Polygon
createSafeTriangle()
private int
findSubMenu(javax.swing.MenuElement[] path)
(package private) static boolean
install()
private void
menuSelectionChanged()
void
stateChanged(javax.swing.event.ChangeEvent e)
(package private) static void
uninstall()
private void
uninstallEventQueue()
-
-
-
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:
stateChanged
in 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()
-
-