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.