Package org.pushingpixels.substance.internal.contrib.randelshofer.quaqua

# Class VisualMargin

java.lang.Object
javax.swing.border.AbstractBorder
org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.VisualMargin

All Implemented Interfaces:
  `Serializable`, `Border`, `UIResource`

public class VisualMargin extends AbstractBorder implements UIResource
The VisualMargin is used to visually align components using bounds based on other criterias than the clip bounds of the component. For example: The clip bounds of a JButton includes its cast shadow and its focus ring. When we align the JButton with a JLabel, we want to align the baseline of the Text of the JButton with the text in the JLabel. The visual margin may be quite large. We allow to programmatically set a smaller margin using the client property "Quaqua.Component.margin".

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`VisualMargin()`
Creates a new VisualMargin.
`VisualMargin(boolean ftop, boolean fleft, boolean fbottom, boolean fright)`
`VisualMargin(int top, int left, int bottom, int right)`
Creates a new VisualMargin.
`VisualMargin(int top, int left, int bottom, int right, boolean ftop, boolean fleft, boolean fbottom, boolean fright)`
`VisualMargin(Insets layoutMargin)`
Creates a new VisualMargin.

## Method Summary

Modifier and Type
Method
Description
`Insets`
`getBorderInsets(Component c)`
`Insets`
`getBorderInsets(Component c, Insets insets)`
Reinitializes the insets parameter with this Border's current Insets.
`Insets`
`getVisualMargin(Component c)`
`protected Insets`
`getVisualMargin(Component c, Insets insets)`
Reinitializes the insets parameter with this Border's current Insets.
`void`
`setFixed(boolean top, boolean left, boolean bottom, boolean right)`
`void`
`setPropertyName(String propertyName)`
The UIManager Property to be used for the default margin.

### Methods inherited from class javax.swing.border.AbstractBorder

`getBaseline, getBaselineResizeBehavior, getInteriorRectangle, getInteriorRectangle, isBorderOpaque, paintBorder`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### VisualMargin

public VisualMargin()
Creates a new VisualMargin.

### VisualMargin

public VisualMargin(int top, int left, int bottom, int right)
Creates a new VisualMargin.

Parameters:
  `top` - Defines the margin from the clip bounds of the component to its visual bounds.
  `left` - Defines the margin from the clip bounds of the component to its visual bounds.
  `bottom` - Defines the margin from the clip bounds of the component to its visual bounds.
  `right` - Defines the margin from the clip bounds of the component to its visual bounds.

### VisualMargin

public VisualMargin(int top, int left, int bottom, int right, boolean ftop, boolean fleft, boolean fbottom, boolean fright)

### VisualMargin

public VisualMargin(boolean ftop, boolean fleft, boolean fbottom, boolean fright)

### VisualMargin

public VisualMargin(Insets layoutMargin)
Creates a new VisualMargin.

Parameters:
  `layoutMargin` - Defines the margin from the clip bounds of the component to its visual bounds. The margin has usually negative values!

## Method Details

### setPropertyName

public void setPropertyName(String propertyName)
The UIManager Property to be used for the default margin.

### setFixed

public void setFixed(boolean top, boolean left, boolean bottom, boolean right)

### getVisualMargin

public Insets getVisualMargin(Component c)

### getBorderInsets

public Insets getBorderInsets(Component c)

Specified by:
  `getBorderInsets` in interface `Border`
Overrides:
  `getBorderInsets` in class `AbstractBorder`

### getBorderInsets

public Insets getBorderInsets(Component c, Insets insets)
Reinitializes the insets parameter with this Border's current Insets.

Overrides:
  `getBorderInsets` in class `AbstractBorder`
Parameters:
  `c` - the component for which this border insets value applies
  `insets` - the object to be reinitialized
Returns:
  the `insets` object

### getVisualMargin

protected Insets getVisualMargin(Component c, Insets insets)
Reinitializes the insets parameter with this Border's current Insets.

Parameters:
  `c` - the component for which this border insets value applies
  `insets` - the object to be reinitialized
Returns:
  the `insets` object