Class VisualMargin
- java.lang.Object
-
- javax.swing.border.AbstractBorder
-
- org.pushingpixels.radiance.theming.internal.contrib.randelshofer.quaqua.VisualMargin
-
- All Implemented Interfaces:
java.io.Serializable
,javax.swing.border.Border
,javax.swing.plaf.UIResource
public class VisualMargin extends javax.swing.border.AbstractBorder implements javax.swing.plaf.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".- Version:
- 2.2 2005-10-01 Added method getVisualMargin.
2.1 2005-06-21 Implements UIResource.
2.0 2005-05-08 Renamed from BorderMargin to VisualMargin. Reworked API.
1.0 31 March 2005 Created. - See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
isBottomFixed
private boolean
isLeftFixed
private boolean
isRightFixed
private boolean
isTopFixed
private java.awt.Insets
layoutMargin
Defines the margin from the clip bounds of the component to its visually perceived borderline.private java.lang.String
propertyName
The Client Property to be used for the default margin.private java.lang.String
uiManagerPropertyName
The UIManager Property to be used for the default margin.
-
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(java.awt.Insets layoutMargin)
Creates a new VisualMargin.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Insets
getBorderInsets(java.awt.Component c)
java.awt.Insets
getBorderInsets(java.awt.Component c, java.awt.Insets insets)
Reinitializes the insets parameter with this Border's current Insets.java.awt.Insets
getVisualMargin(java.awt.Component c)
protected java.awt.Insets
getVisualMargin(java.awt.Component c, java.awt.Insets insets)
Reinitializes the insets parameter with this Border's current Insets.void
setFixed(boolean top, boolean left, boolean bottom, boolean right)
void
setPropertyName(java.lang.String propertyName)
The UIManager Property to be used for the default margin.
-
-
-
Field Detail
-
layoutMargin
private java.awt.Insets layoutMargin
Defines the margin from the clip bounds of the component to its visually perceived borderline.
-
uiManagerPropertyName
private java.lang.String uiManagerPropertyName
The UIManager Property to be used for the default margin.
-
propertyName
private java.lang.String propertyName
The Client Property to be used for the default margin.
-
isTopFixed
private boolean isTopFixed
-
isLeftFixed
private boolean isLeftFixed
-
isBottomFixed
private boolean isBottomFixed
-
isRightFixed
private boolean isRightFixed
-
-
Constructor Detail
-
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(java.awt.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 Detail
-
setPropertyName
public void setPropertyName(java.lang.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 java.awt.Insets getVisualMargin(java.awt.Component c)
-
getBorderInsets
public java.awt.Insets getBorderInsets(java.awt.Component c)
- Specified by:
getBorderInsets
in interfacejavax.swing.border.Border
- Overrides:
getBorderInsets
in classjavax.swing.border.AbstractBorder
-
getBorderInsets
public java.awt.Insets getBorderInsets(java.awt.Component c, java.awt.Insets insets)
Reinitializes the insets parameter with this Border's current Insets.- Overrides:
getBorderInsets
in classjavax.swing.border.AbstractBorder
- Parameters:
c
- the component for which this border insets value appliesinsets
- the object to be reinitialized- Returns:
- the
insets
object
-
getVisualMargin
protected java.awt.Insets getVisualMargin(java.awt.Component c, java.awt.Insets insets)
Reinitializes the insets parameter with this Border's current Insets.- Parameters:
c
- the component for which this border insets value appliesinsets
- the object to be reinitialized- Returns:
- the
insets
object
-
-