Package org.jjazz.flatcomponents.api
Class BorderManager
java.lang.Object
org.jjazz.flatcomponents.api.BorderManager
- All Implemented Interfaces:
MouseListener
,MouseMotionListener
,PropertyChangeListener
,EventListener
,AncestorListener
public class BorderManager
extends Object
implements MouseListener, MouseMotionListener, PropertyChangeListener, AncestorListener
Manage the border changes when a mouse is over registered (flat) components, and when component is enabled/disabled.
This manager allows to disable the border change on mouseEntered for a component if this is actually a mouse drag on another component.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
ancestorAdded
(AncestorEvent event) void
ancestorMoved
(AncestorEvent event) void
ancestorRemoved
(AncestorEvent event) The border to be used for component c when in the entered state.The border to be used for component c when not in pressed or entered state.The border to be used for component c when in the pressed state.The default border "entered" to be used when no specific per-component border is set.The default border "nothing" to be used when no specific per-component border is set.The default border "pressed" to be used when no specific per-component border is set.static BorderManager
void
void
void
void
void
void
void
void
void
register
(JComponent component) Register the component with no special handling for mouse pressed or mouse enter/exit, and can not be dragged.void
register
(JComponent component, boolean enablePressedBorder, boolean enableEnteredBorder, boolean enableDrag) Register the component so this object will manage its border changes.final void
setBorderEntered
(JComponent c, Border b) final void
setBorderNothing
(JComponent c, Border b) final void
setBorderPressed
(JComponent c, Border b) final void
final void
final void
void
unregister
(JComponent component)
-
Field Details
-
DEFAULT_BORDER_NOTHING
-
DEFAULT_BORDER_ENTERED
-
DEFAULT_BORDER_PRESSED
-
-
Method Details
-
getInstance
-
register
Register the component with no special handling for mouse pressed or mouse enter/exit, and can not be dragged.- Parameters:
component
-- See Also:
-
register(JComponent, boolean, boolean)
-
register
public void register(JComponent component, boolean enablePressedBorder, boolean enableEnteredBorder, boolean enableDrag) Register the component so this object will manage its border changes.- Parameters:
component
-enablePressedBorder
- if true border changes while button is pressedenableEnteredBorder
- if true border changes when mouse enters/exitsenableDrag
- if true this component can be dragged
-
unregister
-
getBorderNothing
The border to be used for component c when not in pressed or entered state.- Parameters:
c
-- Returns:
- Can be null
-
setBorderNothing
- Parameters:
c
-b
-
-
getBorderPressed
The border to be used for component c when in the pressed state.- Parameters:
c
-- Returns:
- Can be null
-
setBorderPressed
- Parameters:
c
-b
-
-
getBorderEntered
The border to be used for component c when in the entered state.- Parameters:
c
-- Returns:
- Can be null
-
setBorderEntered
- Parameters:
c
-b
-
-
getDefaultBorderNothing
The default border "nothing" to be used when no specific per-component border is set.- Returns:
- the borderDefault
-
setDefaultBorderNothing
-
getDefaultBorderPressed
The default border "pressed" to be used when no specific per-component border is set.- Returns:
- the borderDefault
-
setDefaultBorderPressed
-
getDefaultBorderEntered
The default border "entered" to be used when no specific per-component border is set.- Returns:
- the borderDefault
-
setDefaultBorderEntered
- Parameters:
b
- the defaultBorderEntered to set
-
ancestorAdded
- Specified by:
ancestorAdded
in interfaceAncestorListener
-
ancestorRemoved
- Specified by:
ancestorRemoved
in interfaceAncestorListener
-
ancestorMoved
- Specified by:
ancestorMoved
in interfaceAncestorListener
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
-
mouseExited
- Specified by:
mouseExited
in interfaceMouseListener
-
mouseClicked
- Specified by:
mouseClicked
in interfaceMouseListener
-
mousePressed
- Specified by:
mousePressed
in interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
- Parameters:
e
- Source component is always the original component for which mouse was initally pressed (event if release point is outside this component)
-
mouseDragged
- Specified by:
mouseDragged
in interfaceMouseMotionListener
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
-
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
-