Package net.infonode.properties.gui.util
Class ComponentProperties
- java.lang.Object
-
- net.infonode.properties.propertymap.PropertyMapContainer
-
- net.infonode.properties.gui.util.ComponentProperties
-
public class ComponentProperties extends PropertyMapContainer
Properties and property values for aJComponent
.
-
-
Field Summary
Fields Modifier and Type Field Description static ColorProperty
BACKGROUND_COLOR
Component background color.static BorderProperty
BORDER
Component border.static FontProperty
FONT
Component text font.static ColorProperty
FOREGROUND_COLOR
Component foreground color.static InsetsProperty
INSETS
Component insets inside the border.static PropertyMapGroup
PROPERTIES
Property group for all component properties.
-
Constructor Summary
Constructors Constructor Description ComponentProperties()
Creates an empty property object.ComponentProperties(ComponentProperties inheritFrom)
Creates a property object that inherit values from another property object.ComponentProperties(PropertyMap map)
Creates a property map containing the map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ComponentProperties
addSuperObject(ComponentProperties properties)
Adds a super object from which property values are inherited.void
applyTo(javax.swing.JComponent component)
Applies the property values to a component.void
applyTo(javax.swing.JComponent component, Direction insetsDirection)
Applies the property values to a component and rotates the insets in the given direction.java.awt.Color
getBackgroundColor()
Returns the component background color.javax.swing.border.Border
getBorder()
Returns the component border.java.awt.Font
getFont()
Returns the component text font.java.awt.Color
getForegroundColor()
Returns the component foreground color.java.awt.Insets
getInsets()
Returns the component insets inside the border.ComponentProperties
removeSuperObject()
Removes the last added super object.ComponentProperties
removeSuperObject(ComponentProperties superObject)
Removes the given super object.ComponentProperties
setBackgroundColor(java.awt.Color color)
Sets the component background color.ComponentProperties
setBorder(javax.swing.border.Border border)
Sets the component border.ComponentProperties
setFont(java.awt.Font font)
Sets the component text font.ComponentProperties
setForegroundColor(java.awt.Color foregroundColor)
Sets the component foreground color.ComponentProperties
setInsets(java.awt.Insets insets)
Sets the component insets inside the border.-
Methods inherited from class net.infonode.properties.propertymap.PropertyMapContainer
getMap
-
-
-
-
Field Detail
-
PROPERTIES
public static final PropertyMapGroup PROPERTIES
Property group for all component properties.
-
BORDER
public static final BorderProperty BORDER
Component border.
-
INSETS
public static final InsetsProperty INSETS
Component insets inside the border.
-
FOREGROUND_COLOR
public static final ColorProperty FOREGROUND_COLOR
Component foreground color.
-
FONT
public static final FontProperty FONT
Component text font.
-
BACKGROUND_COLOR
public static final ColorProperty BACKGROUND_COLOR
Component background color. A null value means that no background will be painted.
-
-
Constructor Detail
-
ComponentProperties
public ComponentProperties()
Creates an empty property object.
-
ComponentProperties
public ComponentProperties(PropertyMap map)
Creates a property map containing the map.- Parameters:
map
- the property map
-
ComponentProperties
public ComponentProperties(ComponentProperties inheritFrom)
Creates a property object that inherit values from another property object.- Parameters:
inheritFrom
- the object from which to inherit property values
-
-
Method Detail
-
addSuperObject
public ComponentProperties addSuperObject(ComponentProperties properties)
Adds a super object from which property values are inherited.- Parameters:
properties
- the object from which to inherit property values- Returns:
- this
-
removeSuperObject
public ComponentProperties removeSuperObject()
Removes the last added super object.- Returns:
- this
-
removeSuperObject
public ComponentProperties removeSuperObject(ComponentProperties superObject)
Removes the given super object.- Parameters:
superObject
- super object to remove- Returns:
- this
-
setBorder
public ComponentProperties setBorder(javax.swing.border.Border border)
Sets the component border.- Parameters:
border
- the component border- Returns:
- this
-
setInsets
public ComponentProperties setInsets(java.awt.Insets insets)
Sets the component insets inside the border.- Parameters:
insets
- the component insets- Returns:
- this
-
setBackgroundColor
public ComponentProperties setBackgroundColor(java.awt.Color color)
Sets the component background color.- Parameters:
color
- the background color, null means no background- Returns:
- this
-
getInsets
public java.awt.Insets getInsets()
Returns the component insets inside the border.- Returns:
- the component insets inside the border
-
getBorder
public javax.swing.border.Border getBorder()
Returns the component border.- Returns:
- the component border
-
getBackgroundColor
public java.awt.Color getBackgroundColor()
Returns the component background color.- Returns:
- the component background color
-
getFont
public java.awt.Font getFont()
Returns the component text font.- Returns:
- the component text font
-
getForegroundColor
public java.awt.Color getForegroundColor()
Returns the component foreground color.- Returns:
- the component foreground color
-
setForegroundColor
public ComponentProperties setForegroundColor(java.awt.Color foregroundColor)
Sets the component foreground color.- Parameters:
foregroundColor
- the component foreground color- Returns:
- this
-
setFont
public ComponentProperties setFont(java.awt.Font font)
Sets the component text font.- Parameters:
font
- the component text font- Returns:
- this
-
applyTo
public void applyTo(javax.swing.JComponent component)
Applies the property values to a component.- Parameters:
component
- the component on which to apply the property values
-
applyTo
public void applyTo(javax.swing.JComponent component, Direction insetsDirection)
Applies the property values to a component and rotates the insets in the given direction.- Parameters:
component
- the component on which to apply the property valuesinsetsDirection
- insets direction
-
-