Class FlatRadioButtonUI.AWTPeerMouseExitedFix
java.lang.Object
java.awt.event.MouseAdapter
com.formdev.flatlaf.ui.FlatRadioButtonUI.AWTPeerMouseExitedFix
- All Implemented Interfaces:
MouseListener, MouseMotionListener, MouseWheelListener, PropertyChangeListener, EventListener
- Enclosing class:
FlatRadioButtonUI
private static class FlatRadioButtonUI.AWTPeerMouseExitedFix
extends MouseAdapter
implements PropertyChangeListener
Hack for missing mouse-exited event for java.awt.Checkbox on macOS (to fix hover effect).
On macOS, AWT components internally use Swing components.
This is implemented in class sun.lwawt.LWCheckboxPeer, which uses
a container component CheckboxDelegate that has a JCheckBox and a JRadioButton
as children. Only one of them is visible.
The reason that mouse-exited event is not sent to the JCheckBox or JRadioButton
is that sun.lwawt.LWComponentPeer.createDelegateEvent() uses
SwingUtilities.getDeepestComponentAt() to find the event target,
which finds the container component CheckboxDelegate,
which receives the mouse-exited event.
This class adds listeners and forwards the mouse-exited event
from CheckboxDelegate to JCheckBox or JRadioButton.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static voidinstall(JComponent button) voidvoid(package private) static voiduninstall(JComponent button) Methods inherited from class MouseAdapter
mouseClicked, mouseDragged, mouseEntered, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved
-
Field Details
-
button
-
-
Constructor Details
-
AWTPeerMouseExitedFix
AWTPeerMouseExitedFix(JComponent button)
-
-
Method Details
-
install
-
uninstall
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener- Overrides:
mouseExitedin classMouseAdapter
-