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 Details

    • DEFAULT_BORDER_NOTHING

      public static final Border DEFAULT_BORDER_NOTHING
    • DEFAULT_BORDER_ENTERED

      public static final Border DEFAULT_BORDER_ENTERED
    • DEFAULT_BORDER_PRESSED

      public static final Border DEFAULT_BORDER_PRESSED
  • Method Details

    • getInstance

      public static BorderManager getInstance()
    • register

      public void register(JComponent component)
      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 pressed
      enableEnteredBorder - if true border changes when mouse enters/exits
      enableDrag - if true this component can be dragged
    • unregister

      public void unregister(JComponent component)
    • getBorderNothing

      public Border getBorderNothing(JComponent c)
      The border to be used for component c when not in pressed or entered state.
      Parameters:
      c -
      Returns:
      Can be null
    • setBorderNothing

      public final void setBorderNothing(JComponent c, Border b)
      Parameters:
      c -
      b -
    • getBorderPressed

      public Border getBorderPressed(JComponent c)
      The border to be used for component c when in the pressed state.
      Parameters:
      c -
      Returns:
      Can be null
    • setBorderPressed

      public final void setBorderPressed(JComponent c, Border b)
      Parameters:
      c -
      b -
    • getBorderEntered

      public Border getBorderEntered(JComponent c)
      The border to be used for component c when in the entered state.
      Parameters:
      c -
      Returns:
      Can be null
    • setBorderEntered

      public final void setBorderEntered(JComponent c, Border b)
      Parameters:
      c -
      b -
    • getDefaultBorderNothing

      public Border getDefaultBorderNothing()
      The default border "nothing" to be used when no specific per-component border is set.
      Returns:
      the borderDefault
    • setDefaultBorderNothing

      public final void setDefaultBorderNothing(Border b)
    • getDefaultBorderPressed

      public Border getDefaultBorderPressed()
      The default border "pressed" to be used when no specific per-component border is set.
      Returns:
      the borderDefault
    • setDefaultBorderPressed

      public final void setDefaultBorderPressed(Border b)
    • getDefaultBorderEntered

      public Border getDefaultBorderEntered()
      The default border "entered" to be used when no specific per-component border is set.
      Returns:
      the borderDefault
    • setDefaultBorderEntered

      public final void setDefaultBorderEntered(Border b)
      Parameters:
      b - the defaultBorderEntered to set
    • ancestorAdded

      public void ancestorAdded(AncestorEvent event)
      Specified by:
      ancestorAdded in interface AncestorListener
    • ancestorRemoved

      public void ancestorRemoved(AncestorEvent event)
      Specified by:
      ancestorRemoved in interface AncestorListener
    • ancestorMoved

      public void ancestorMoved(AncestorEvent event)
      Specified by:
      ancestorMoved in interface AncestorListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
      Parameters:
      e - Source component is always the original component for which mouse was initally pressed (event if release point is outside this component)
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      Specified by:
      mouseDragged in interface MouseMotionListener
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Specified by:
      mouseMoved in interface MouseMotionListener
    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Specified by:
      propertyChange in interface PropertyChangeListener