Class Style
Represents the look of a given component: colors, fonts, transparency, margin and padding & images.
Each Component contains a Style Object and allows Style modification in Runtime
by Using cmp.getStyle()
The style is also used in Themeing, when a Theme is Changed the Styles Objects are been
updated automatically.
When changing a theme the elements changed manually in a style will not be updated by the theme change by default. There are two ways to change that behavior:
-
Use the set method that accepts a second boolean argument and set it to true.
-
Create a new style object and pass all the options in the constructor (without invoking setters manually).
The Margin and Padding is inspired by W3 Box Model
**************************
* Margin *
* ******************** *
* * Padding * *
* * *********** * *
* * * Content * * *
* * *********** * *
* * Padding * *
* ******************** *
* Margin *
**************************
Change Events
Styles fire a change event for each style change that occurs. Component listens to all changes events
of its styles, and adjusts some of its properties accordingly. Currently (as of 6.0) each style change will trigger
a Container#revalidate() call on the Style's Component's parent container, which is expensive. You can disable this
Container#revalidate() call by calling CN.setProperty("Component.revalidateOnStyleChange", "false"). This will
likely be the default behavior in a future version, so we recommend you disable this explicitly for both performance reasons, and
to avoid regressions when the default is changed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAlignment attribute for the style eventstatic final StringBackground attribute name for the theme hashtablestatic final StringBackground attribute name for the theme hashtablestatic final byteIndicates the background for the style would use a linear gradientstatic final byteIndicates the background for the style would use a linear gradientstatic final byteIndicates the background for the style would use a radial gradientstatic final byteIndicates the background for the style would use an unscaled image with an alignmentstatic final byteIndicates the background for the style would use an unscaled image with an alignmentstatic final byteIndicates the background for the style would use an unscaled image with an alignmentstatic final byteIndicates the background for the style would use an unscaled image with an alignmentstatic final byteIndicates the background for the style would use an unscaled image with an alignmentstatic final byteIndicates the background for the style would use an unscaled image with an alignmentstatic final byteIndicates the background for the style would use an unscaled image with an alignmentstatic final byteIndicates the background for the style would use an unscaled image with an alignmentstatic final byteIndicates the background for the style would use an unscaled image with an alignmentstatic final byteIndicates the background for the style would use a scaled imagestatic final byteIndicates the background for the style would use a scaled image that fills all available space while maintaining aspect ratiostatic final byteIndicates the background for the style would use a scaled image that fits to available space while maintaining aspect ratiostatic final byteIndicates the background for the style would use a tiled image on both axisstatic final byteIndicates the background for the style would use a horizontal tiled imagestatic final byteIndicates the background for the style would use a horizontal tiled imagestatic final byteIndicates the background for the style would use a horizontal tiled imagestatic final byteIndicates the background for the style would use a horizontal tiled imagestatic final byteIndicates the background for the style would use a vertical tiled imagestatic final byteIndicates the background for the style would use a horizontal tiled imagestatic final byteIndicates the background for the style would use a horizontal tiled imagestatic final byteIndicates the background for the style would use a horizontal tiled imagestatic final byteIndicates the background for the style would use a scaled imagestatic final StringBackground attribute name for the theme hashtablestatic final StringBackground color attribute name for the theme hashtablestatic final StringBackground image attribute name for the theme hashtablestatic final StringBorder attribute name for the theme hashtablestatic final StringElevation attribute name for the theme hashtable.static final StringForeground alpha attribute name for the theme hashtablestatic final StringForeground color attribute name for the theme hashtablestatic final StringFont attribute name for the theme hashtablestatic final StringIcon gap attribute name for the theme hashtable.static final StringIcon gap unit attribute.static final StringMargin attribute name for the theme hashtablestatic final StringThe units of the marginstatic final StringOpacity attribute name for the theme hashtablestatic final StringPadding attribute name for the theme hashtablestatic final StringThe units of the paddingstatic final StringPainter attribute name for the style eventstatic final StringSurface attribute name for the theme hashtable.static final StringText decoration attribute for the style eventstatic final byte3D text effect using a font shadowstatic final byte3D sunken text effect using a light font shadowstatic final byte3D text effect using a font shadowstatic final byteIndicates no text decorationstatic final byteIndicates overlinestatic final byteIndicates a strike-through line (usually used to denote deleted text)static final byteIndicates underlinestatic final StringTransparency attribute name for the theme hashtablestatic final byteIndicates the unit type for padding/margin in device independent pixels.static final byteIndicates the unit type for padding/margin, the default is in device specific pixelsstatic final byteIndicates the unit type for padding/margin relative to the font size of the default font.static final byteIndicates the unit type for padding/margin in percentage of the size of the screenstatic final byteIndicates the unit type for padding/margin as a percentage of the screen height.static final byteIndicates the unit type for padding/margin as a percentage the maximum of screen width and height.static final byteIndicates the unit type for padding/margin as a percentage the minimum of screen width and height.static final byteIndicates the unit type for padding/margin as a percentage of the screen width. -
Constructor Summary
ConstructorsConstructorDescriptionStyle()Each component when it draw itself uses this Object to determine in what colors it should use.Creates a new style with the given attributesCreates a new style with the given attributesCreates a full copy of the given style. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a Style Listener to the Style Object.voidcacheMargins(boolean override) Store current margin values into a cache that could be restored with restoreCachedMargins()static StylecreateProxyStyle(Style... styles) Creates a "proxy" style whose setter methods map to the methods in the given styles passed and whose getter methods are meaninglessbooleanvoidFlush the margins cache if one existsintReturns the alignment of the LabelintEnd color for the radial/linear gradientfloatBackground radial gradient relative sizefloatBackground radial gradient relative center position XfloatBackground radial gradient relative center position YintStart color for the radial/linear gradientbyteThe type of the background defaults to BACKGROUND_IMAGE_SCALEDintBackground color for the componentBackground image for the componentReturn the background painter for this style, normally this would be the internal image/color painter but can be user definedbyteReturns the transparency (opacity) level of the Component, zero indicates fully transparent and FF indicates fully opaque.Returns the border for the styleintGets the elevation value of this style.intForeground alpha for the componentintForeground color for the componentgetFont()Font for the componentintThe equivalent of getMarginLeft + getMarginRightintThe equivalent of getPaddingLeft + getPaddingRightintReturns the icon gap in pixels.intReturns the icon gap unit.intgetMargin(boolean rtl, int orientation) Returns the MarginintgetMargin(int orientation) Returns the MarginintReturns the bottom margin in pixelfloatgetMarginFloatValue(boolean rtl, int orientation) Returns the MarginintgetMarginLeft(boolean rtl) Returns the left margin in pixel or right margin in an RTL situationintReturns the left margin in pixels ignoring RTLintgetMarginRight(boolean rtl) Returns the right margin in pixel or left margin in an RTL situationintReturns the right margin in pixels ignoring RTLintReturns the top margin in pixelbyte[]Indicates the units used for margin elements, if null pixels are used if not this is a 4 element array containing values of of#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,intgetMarginValue(boolean rtl, int orientation) Returns the MarginintReturns the opacity value for the componentintgetPadding(boolean rtl, int orientation) Returns the Padding in using the current unitintgetPadding(int orientation) Returns the PaddingintReturns the bottom padding in pixelfloatgetPaddingFloatValue(boolean rtl, int orientation) Returns the Padding in the internal value regardless of the unitintgetPaddingLeft(boolean rtl) Returns the left padding in pixel or right padding in an RTL situationintReturns the left padding in pixels ignoring RTLintgetPaddingRight(boolean rtl) Returns the right padding in pixel or left padding in an RTL situationintReturns the right padding in pixels ignoring RTLintReturns the top padding in pixelbyte[]Indicates the units used for padding elements, if null pixels are used if not this is a 4 element array containing values of of#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,intgetPaddingValue(boolean rtl, int orientation) Returns the Padding in the internal value regardless of the unitintReturns the text decoration of this styleintThe equivalent of getMarginTop + getMarginBottomintThe equivalent of getPaddingTop + getPaddingBottominthashCode()booleanReturns the text decoration state for the northbooleanReturns true if the 3D text decoration is on, false otherwisebooleanReturns true if the style was modified manually after it was created by the look and feel.booleanReturns true if the overline text decoration is on, false otherwisebooleanReturns true if the 3D text decoration is on, false otherwisebooleanIndicates whether this style has been marked for use with renderers.booleanReturns true if the strike through text decoration is on, false otherwisebooleanChecks to see if change events are currently suppressed.booleanChecks whether the component is a surface.booleanReturns true if the underline text decoration is on, false otherwisevoidDisables native OS optimizations that might collide with cell renderers which do things like sharing style objectsvoidMerges the new style with the current style without changing the elements that were modified.voidThis method removes all Listeners from the StylevoidRemoves a Style Listener from the Style Object.voidRestore cached margins and flush the margins cache Warning: this method is used internally when unhidding a component with the Component.setHidden(false) method Do not use it on an hidden component or it would result into unexpected results when unhidding this componentvoidset3DText(boolean t, boolean raised) Sets the 3D text decoration for this stylevoidset3DTextNorth(boolean north) Sets the text decoration to 3D textvoidsetAlignment(int align) Sets the Alignment of the Label to one of: CENTER, LEFT, RIGHTvoidsetAlignment(int align, boolean override) Sets the Alignment of the Label to one of: CENTER, LEFT, RIGHTvoidsetBackgroundGradientEndColor(int backgroundGradientEndColor) Sets the background color for the componentvoidsetBackgroundGradientEndColor(int backgroundGradientEndColor, boolean override) Sets the background color for the componentvoidsetBackgroundGradientRelativeSize(float backgroundGradientRelativeSize) Background radial gradient relative sizevoidsetBackgroundGradientRelativeSize(float backgroundGradientRelativeSize, boolean override) Background radial gradient relative sizevoidsetBackgroundGradientRelativeX(float backgroundGradientRelativeX) Background radial gradient relative center position XvoidsetBackgroundGradientRelativeX(float backgroundGradientRelativeX, boolean override) Background radial gradient relative center position XvoidsetBackgroundGradientRelativeY(float backgroundGradientRelativeY) Background radial gradient relative center position YvoidsetBackgroundGradientRelativeY(float backgroundGradientRelativeY, boolean override) Background radial gradient relative center position YvoidsetBackgroundGradientStartColor(int backgroundGradientStartColor) Sets the background color for the componentvoidsetBackgroundGradientStartColor(int backgroundGradientStartColor, boolean override) Sets the background color for the componentvoidsetBackgroundType(byte backgroundType) Sets the background type for the componentvoidsetBackgroundType(byte backgroundType, boolean override) Sets the background type for the componentvoidsetBgColor(int bgColor) Sets the background color for the componentvoidsetBgColor(int bgColor, boolean override) Sets the background color for the componentvoidsetBgImage(Image bgImage) Sets the background image for the componentvoidsetBgImage(Image bgImage, boolean override) Sets the background image for the componentvoidsetBgPainter(Painter bgPainter) Defines the background painter for this style, normally this would be the internal image/color painter but can be user definedvoidsetBgTransparency(byte transparency) Sets the Component transparency (opacity) level of the Component, zero indicates fully transparent and FF indicates fully opaque.voidsetBgTransparency(int transparency) Sets the Component transparency level.voidsetBgTransparency(int transparency, boolean override) Sets the Component transparency level.voidSets the border for the stylevoidSets the border for the stylevoidsetElevation(int elevation) Sets the elevation value.voidsetElevation(int elevation, boolean override) Sets the elevation value.voidsetFgAlpha(int fgAlpha) Sets the foreground alpha for the componentvoidsetFgAlpha(int fgAlpha, boolean override) Sets the foreground alpha for the componentfinal voidsetFgColor(int fgColor) Sets the foreground color for the componentfinal voidsetFgColor(int fgColor, boolean override) Sets the foreground color for the componentvoidSets the font for the componentvoidSets the font for the componentvoidsetIconGap(float gap) Sets the icon gap in the current units.voidsetIconGap(float gap, boolean override) Sets the icon gap.voidsetIconGap(float gap, byte unit) Sets the icon gap.voidsetIconGap(float gap, byte units, boolean override) Sets the icon gap.voidsetIconGapUnit(byte unit) Sets the icon gap unit.voidsetIconGapUnit(byte unit, boolean override) Sets the icon gap unit.voidsetMargin(float top, float bottom, float left, float right) Sets the Style MarginvoidsetMargin(int orientation, float gap) Sets the Style MarginvoidsetMargin(int orientation, float gap, boolean override) Sets the Style MarginvoidsetMargin(int orientation, int gap) Sets the Style MarginvoidsetMargin(int orientation, int gap, boolean override) Sets the Style MarginvoidsetMargin(int top, int bottom, int left, int right) Sets the Style MarginvoidsetMarginBottom(float gap) Sets the Style Margin on the bottom, this is equivalent to callingsetMargin(Component.BOTTOM, gap, false);voidsetMarginBottom(int gap) Sets the Style Margin on the bottom, this is equivalent to callingsetMargin(Component.BOTTOM, gap, false);voidsetMarginLeft(float gap) Sets the Style Margin on the left, this is equivalent to callingsetMargin(Component.LEFT, gap, false);voidsetMarginLeft(int gap) Sets the Style Margin on the left, this is equivalent to callingsetMargin(Component.LEFT, gap, false);voidsetMarginRight(float gap) Sets the Style Margin on the right, this is equivalent to callingsetMargin(Component.RIGHT, gap, false);voidsetMarginRight(int gap) Sets the Style Margin on the right, this is equivalent to callingsetMargin(Component.RIGHT, gap, false);voidsetMarginTop(float gap) Sets the Style margin on the top, this is equivalent to callingsetMargin(Component.TOP, gap, false);voidsetMarginTop(int gap) Sets the Style margin on the top, this is equivalent to callingsetMargin(Component.TOP, gap, false);voidsetMarginUnit(byte... marginUnit) Indicates the units used for margin elements, if null pixels are used if not this is a 4 element array containing values of of#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,voidsetMarginUnitBottom(byte unit) Sets bottom margin unit.voidsetMarginUnitLeft(byte unit) Sets left margin unit.voidsetMarginUnitRight(byte unit) Sets right margin unit.voidsetMarginUnitTop(byte unit) Sets top margin unit.final voidsetOpacity(int opacity) Set the opacity valuefinal voidsetOpacity(int opacity, boolean override) Sets the Component transparency level.voidsetOverline(boolean overline) Sets the overline text decoration for this stylevoidsetPadding(float top, float bottom, float left, float right) Sets the Style Padding.voidsetPadding(int orientation, float gap) Sets the Style Padding.voidsetPadding(int orientation, float gap, boolean override) Sets the Style PaddingvoidsetPadding(int orientation, int gap) Sets the Style Padding.voidsetPadding(int orientation, int gap, boolean override) Sets the Style PaddingvoidsetPadding(int top, int bottom, int left, int right) Sets the Style Padding.voidsetPaddingBottom(float gap) Sets the Style Padding on the bottom, this is equivalent to callingsetPadding(Component.BOTTOM, gap, false);voidsetPaddingBottom(int gap) Sets the Style Padding on the bottom, this is equivalent to callingsetPadding(Component.BOTTOM, gap, false);voidsetPaddingLeft(float gap) Sets the Style Padding on the left, this is equivalent to callingsetPadding(Component.LEFT, gap, false);voidsetPaddingLeft(int gap) Sets the Style Padding on the left, this is equivalent to callingsetPadding(Component.LEFT, gap, false);voidsetPaddingRight(float gap) Sets the Style Padding on the right, this is equivalent to callingsetPadding(Component.RIGHT, gap, false);voidsetPaddingRight(int gap) Sets the Style Padding on the right, this is equivalent to callingsetPadding(Component.RIGHT, gap, false);voidsetPaddingTop(float gap) Sets the Style Padding on the top, this is equivalent to callingsetPadding(Component.TOP, gap, false);voidsetPaddingTop(int gap) Sets the Style Padding on the top, this is equivalent to callingsetPadding(Component.TOP, gap, false);voidsetPaddingUnit(byte... paddingUnit) Indicates the units used for padding elements, if null pixels are used if not this is a 4 element array containing values of#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,#UNIT_TYPE_VMIN,#UNIT_TYPE_VMAX,#UNIT_TYPE_REM.voidsetPaddingUnitBottom(byte unit) Sets bottom padding unit.voidsetPaddingUnitLeft(byte unit) Sets left padding unit.voidsetPaddingUnitRight(byte unit) Sets right padding unit.voidsetPaddingUnitTop(byte unit) Sets top padding unit.voidsetStrikeThru(boolean strikethru) Sets the strike through text decoration for this stylevoidsetSuppressChangeEvents(boolean suppress) Enables or disables events.voidsetSurface(boolean surface) Enables or disables surface rendering mode for component.voidsetSurface(boolean surface, boolean override) Enables or disables surface rendering mode for component.voidsetTextDecoration(int textDecoration) Sets the text decoration of this stylevoidsetTextDecoration(int textDecoration, boolean override) Sets the text decoration of this stylevoidsetUnderline(boolean underline) Sets the underline text decoration for this stylevoidStrips all margin and padding from this style.
-
Field Details
-
BG_COLOR
Background color attribute name for the theme hashtable- See Also:
-
FG_COLOR
Foreground color attribute name for the theme hashtable- See Also:
-
FG_ALPHA
Foreground alpha attribute name for the theme hashtable- See Also:
-
BG_IMAGE
Background image attribute name for the theme hashtable- See Also:
-
BACKGROUND_TYPE
Background attribute name for the theme hashtable- See Also:
-
BACKGROUND_ALIGNMENT
Background attribute name for the theme hashtable- See Also:
-
BACKGROUND_GRADIENT
Background attribute name for the theme hashtable- See Also:
-
FONT
-
TRANSPARENCY
Transparency attribute name for the theme hashtable- See Also:
-
OPACITY
-
ELEVATION
-
ICON_GAP
Icon gap attribute name for the theme hashtable.
Since
8.0
- See Also:
-
ICON_GAP_UNIT
-
SURFACE
-
MARGIN
-
BORDER
-
PADDING
-
PAINTER
-
ALIGNMENT
-
TEXT_DECORATION
-
PADDING_UNIT
-
MARGIN_UNIT
-
BACKGROUND_NONE
public static final byte BACKGROUND_NONEIndicates the background for the style would use a scaled image- See Also:
-
BACKGROUND_IMAGE_SCALED
public static final byte BACKGROUND_IMAGE_SCALEDIndicates the background for the style would use a scaled image- See Also:
-
BACKGROUND_IMAGE_TILE_BOTH
public static final byte BACKGROUND_IMAGE_TILE_BOTHIndicates the background for the style would use a tiled image on both axis- See Also:
-
BACKGROUND_IMAGE_TILE_VERTICAL
public static final byte BACKGROUND_IMAGE_TILE_VERTICALIndicates the background for the style would use a vertical tiled image- See Also:
-
BACKGROUND_IMAGE_TILE_HORIZONTAL
public static final byte BACKGROUND_IMAGE_TILE_HORIZONTALIndicates the background for the style would use a horizontal tiled image- See Also:
-
BACKGROUND_IMAGE_ALIGNED_TOP
public static final byte BACKGROUND_IMAGE_ALIGNED_TOPIndicates the background for the style would use an unscaled image with an alignment- See Also:
-
BACKGROUND_IMAGE_ALIGNED_BOTTOM
public static final byte BACKGROUND_IMAGE_ALIGNED_BOTTOMIndicates the background for the style would use an unscaled image with an alignment- See Also:
-
BACKGROUND_IMAGE_ALIGNED_LEFT
public static final byte BACKGROUND_IMAGE_ALIGNED_LEFTIndicates the background for the style would use an unscaled image with an alignment- See Also:
-
BACKGROUND_IMAGE_ALIGNED_RIGHT
public static final byte BACKGROUND_IMAGE_ALIGNED_RIGHTIndicates the background for the style would use an unscaled image with an alignment- See Also:
-
BACKGROUND_IMAGE_ALIGNED_CENTER
public static final byte BACKGROUND_IMAGE_ALIGNED_CENTERIndicates the background for the style would use an unscaled image with an alignment- See Also:
-
BACKGROUND_IMAGE_ALIGNED_TOP_LEFT
public static final byte BACKGROUND_IMAGE_ALIGNED_TOP_LEFTIndicates the background for the style would use an unscaled image with an alignment- See Also:
-
BACKGROUND_IMAGE_ALIGNED_TOP_RIGHT
public static final byte BACKGROUND_IMAGE_ALIGNED_TOP_RIGHTIndicates the background for the style would use an unscaled image with an alignment- See Also:
-
BACKGROUND_IMAGE_ALIGNED_BOTTOM_LEFT
public static final byte BACKGROUND_IMAGE_ALIGNED_BOTTOM_LEFTIndicates the background for the style would use an unscaled image with an alignment- See Also:
-
BACKGROUND_IMAGE_ALIGNED_BOTTOM_RIGHT
public static final byte BACKGROUND_IMAGE_ALIGNED_BOTTOM_RIGHTIndicates the background for the style would use an unscaled image with an alignment- See Also:
-
BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_TOP
public static final byte BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_TOPIndicates the background for the style would use a horizontal tiled image- See Also:
-
BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_CENTER
public static final byte BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_CENTERIndicates the background for the style would use a horizontal tiled image- See Also:
-
BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_BOTTOM
public static final byte BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_BOTTOMIndicates the background for the style would use a horizontal tiled image- See Also:
-
BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_LEFT
public static final byte BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_LEFTIndicates the background for the style would use a horizontal tiled image- See Also:
-
BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_CENTER
public static final byte BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_CENTERIndicates the background for the style would use a horizontal tiled image- See Also:
-
BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_RIGHT
public static final byte BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_RIGHTIndicates the background for the style would use a horizontal tiled image- See Also:
-
BACKGROUND_IMAGE_SCALED_FILL
public static final byte BACKGROUND_IMAGE_SCALED_FILLIndicates the background for the style would use a scaled image that fills all available space while maintaining aspect ratio- See Also:
-
BACKGROUND_IMAGE_SCALED_FIT
public static final byte BACKGROUND_IMAGE_SCALED_FITIndicates the background for the style would use a scaled image that fits to available space while maintaining aspect ratio- See Also:
-
BACKGROUND_GRADIENT_LINEAR_VERTICAL
public static final byte BACKGROUND_GRADIENT_LINEAR_VERTICALIndicates the background for the style would use a linear gradient- See Also:
-
BACKGROUND_GRADIENT_LINEAR_HORIZONTAL
public static final byte BACKGROUND_GRADIENT_LINEAR_HORIZONTALIndicates the background for the style would use a linear gradient- See Also:
-
BACKGROUND_GRADIENT_RADIAL
public static final byte BACKGROUND_GRADIENT_RADIALIndicates the background for the style would use a radial gradient- See Also:
-
TEXT_DECORATION_NONE
public static final byte TEXT_DECORATION_NONEIndicates no text decoration- See Also:
-
TEXT_DECORATION_UNDERLINE
public static final byte TEXT_DECORATION_UNDERLINEIndicates underline- See Also:
-
TEXT_DECORATION_STRIKETHRU
public static final byte TEXT_DECORATION_STRIKETHRUIndicates a strike-through line (usually used to denote deleted text)- See Also:
-
TEXT_DECORATION_OVERLINE
public static final byte TEXT_DECORATION_OVERLINEIndicates overline- See Also:
-
TEXT_DECORATION_3D
public static final byte TEXT_DECORATION_3D3D text effect using a font shadow- See Also:
-
TEXT_DECORATION_3D_LOWERED
public static final byte TEXT_DECORATION_3D_LOWERED3D sunken text effect using a light font shadow- See Also:
-
TEXT_DECORATION_3D_SHADOW_NORTH
public static final byte TEXT_DECORATION_3D_SHADOW_NORTH3D text effect using a font shadow- See Also:
-
UNIT_TYPE_PIXELS
public static final byte UNIT_TYPE_PIXELSIndicates the unit type for padding/margin, the default is in device specific pixels- See Also:
-
UNIT_TYPE_SCREEN_PERCENTAGE
public static final byte UNIT_TYPE_SCREEN_PERCENTAGEIndicates the unit type for padding/margin in percentage of the size of the screen- See Also:
-
UNIT_TYPE_DIPS
public static final byte UNIT_TYPE_DIPSIndicates the unit type for padding/margin in device independent pixels. Device independent pixels try to aim at roughly 1 millimeter of the screen per DIP but make no guarantee for accuracy.- See Also:
-
UNIT_TYPE_VW
public static final byte UNIT_TYPE_VWIndicates the unit type for padding/margin as a percentage of the screen width.
Since
8.0
- See Also:
-
UNIT_TYPE_VH
public static final byte UNIT_TYPE_VHIndicates the unit type for padding/margin as a percentage of the screen height.
Since
8.0
- See Also:
-
UNIT_TYPE_VMIN
public static final byte UNIT_TYPE_VMINIndicates the unit type for padding/margin as a percentage the minimum of screen width and height.
Since
8.0
- See Also:
-
UNIT_TYPE_VMAX
public static final byte UNIT_TYPE_VMAXIndicates the unit type for padding/margin as a percentage the maximum of screen width and height.
Since
8.0
- See Also:
-
UNIT_TYPE_REM
public static final byte UNIT_TYPE_REMIndicates the unit type for padding/margin relative to the font size of the default font. 1rem == Font.getDefaultFont().getHeight()
Since
8.0
- See Also:
-
-
Constructor Details
-
Style
public Style()Each component when it draw itself uses this Object to determine in what colors it should use. When a Component is generated it construct a default Style Object. The Default values for each Component can be changed by using the UIManager class -
Style
Creates a full copy of the given style. Notice that if the original style was modified manually (by invoking setters on it) it would not chnage when changing a theme/look and feel, however this newly created style would change in such a case.
Parameters
style: the style to copy
-
Style
Creates a new style with the given attributes
Parameters
-
fgColor: foreground color -
bgColor: background color -
f: font -
transparency: transparency value
-
-
Style
Creates a new style with the given attributes
Parameters
-
fgColor: foreground color -
bgColor: background color -
f: font -
transparency: transparency value -
im: background image -
backgroundType: @param backgroundType one of: BACKGROUND_IMAGE_SCALED, BACKGROUND_IMAGE_TILE_BOTH, BACKGROUND_IMAGE_TILE_VERTICAL, BACKGROUND_IMAGE_TILE_HORIZONTAL, BACKGROUND_IMAGE_ALIGNED, BACKGROUND_GRADIENT_LINEAR_HORIZONTAL, BACKGROUND_GRADIENT_LINEAR_VERTICAL, BACKGROUND_GRADIENT_RADIAL
-
-
-
Method Details
-
createProxyStyle
-
markAsRendererStyle
public void markAsRendererStyle()Disables native OS optimizations that might collide with cell renderers which do things like sharing style objects -
isRendererStyle
public boolean isRendererStyle()Indicates whether this style has been marked for use with renderers.
Returns
trueif#markAsRendererStyle()was invoked. -
merge
Merges the new style with the current style without changing the elements that were modified.
Parameters
style: new values of styles from the current theme
-
getElevation
public int getElevation()Gets the elevation value of this style. Valid values include 0, 1, 2, 3, 4, 6, 8, 9, 12, 16, and 24.
Returns
The elevation value. Default is 0.
Since
8.0
-
setElevation
public void setElevation(int elevation) Sets the elevation value. Valid values include 0, 1, 2, 3, 4, 6, 8, 9, 12, 16, and 24.
Parameters
elevation: The elevation value.
Since
8.0
-
getIconGap
public int getIconGap()Returns the icon gap in pixels.
Since
8.0
-
setIconGap
public void setIconGap(float gap) Sets the icon gap in the current units.
Parameters
gap: The icon gap.
Since
8.0
See also
- #getIconGapUnit()
-
getIconGapUnit
public int getIconGapUnit()Returns the icon gap unit. One of
#UNIT_TYPE_REM,#UNIT_TYPE_VMAX,#UNIT_TYPE_VMIN,#UNIT_TYPE_VH,#UNIT_TYPE_VW,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_DIPS,#UNIT_TYPE_PIXELSReturns
The icon gap unit
Since
8.0
-
setIconGapUnit
public void setIconGapUnit(byte unit) Sets the icon gap unit.
Parameters
unit: The icon gap unit. One of the standard style units of measurement.
Since
8.0
-
isSurface
public boolean isSurface()Checks whether the component is a surface. Surface containers support a sort of z-index of descendants via the elevation attribute. Surfaces will render the shadows of elevated descendants to convey depth.
Returns
True if container should be rendered as a surface.
Since
8.0
-
setSurface
public void setSurface(boolean surface) Enables or disables surface rendering mode for component. Surfaces can support a sort of z-indexing of its descendants via their elevation properties. The surface will render the shadows of elevated descendants to convey depth.
Parameters
surface: True to enable surface rendering mode.
Since
8.0
-
isModified
public boolean isModified()Returns true if the style was modified manually after it was created by the look and feel. If the style was modified manually (by one of the set methods) then it should be merged rather than overwritten.
Returns
true if the style was modified
-
getBgColor
public int getBgColor()Background color for the component
Returns
the background color for the component
-
setBgColor
public void setBgColor(int bgColor) Sets the background color for the component
Parameters
bgColor: RRGGBB color that ignors the alpha component
-
getBgImage
Background image for the component
Returns
the background image for the component
-
setBgImage
Sets the background image for the component
Parameters
bgImage: background image
-
getBackgroundType
public byte getBackgroundType()The type of the background defaults to BACKGROUND_IMAGE_SCALED
Returns
- Returns:
- one of: BACKGROUND_IMAGE_SCALED, BACKGROUND_IMAGE_TILE_BOTH, BACKGROUND_IMAGE_TILE_VERTICAL, BACKGROUND_IMAGE_TILE_HORIZONTAL, BACKGROUND_IMAGE_ALIGNED, BACKGROUND_GRADIENT_LINEAR_HORIZONTAL, BACKGROUND_GRADIENT_LINEAR_VERTICAL, BACKGROUND_GRADIENT_RADIAL
-
setBackgroundType
public void setBackgroundType(byte backgroundType) Sets the background type for the component
Parameters
backgroundType: @param backgroundType one of BACKGROUND_IMAGE_SCALED, BACKGROUND_IMAGE_TILE_BOTH, BACKGROUND_IMAGE_TILE_VERTICAL, BACKGROUND_IMAGE_TILE_HORIZONTAL, BACKGROUND_IMAGE_ALIGNED, BACKGROUND_GRADIENT_LINEAR_HORIZONTAL, BACKGROUND_GRADIENT_LINEAR_VERTICAL, BACKGROUND_GRADIENT_RADIAL
-
getBackgroundGradientStartColor
public int getBackgroundGradientStartColor()Start color for the radial/linear gradient
Returns
the start color for the radial/linear gradient
-
setBackgroundGradientStartColor
public void setBackgroundGradientStartColor(int backgroundGradientStartColor) Sets the background color for the component
Parameters
backgroundGradientStartColor: start color for the linear/radial gradient
-
getBackgroundGradientEndColor
public int getBackgroundGradientEndColor()End color for the radial/linear gradient
Returns
the end color for the radial/linear gradient
-
setBackgroundGradientEndColor
public void setBackgroundGradientEndColor(int backgroundGradientEndColor) Sets the background color for the component
Parameters
backgroundGradientEndColor: end color for the linear/radial gradient
-
getBackgroundGradientRelativeX
public float getBackgroundGradientRelativeX()Background radial gradient relative center position X
Returns
value between 0 and 1 with 0.5 representing the center of the component
-
setBackgroundGradientRelativeX
public void setBackgroundGradientRelativeX(float backgroundGradientRelativeX) Background radial gradient relative center position X
Parameters
backgroundGradientRelativeX: x position of the radial gradient center
-
getBackgroundGradientRelativeY
public float getBackgroundGradientRelativeY()Background radial gradient relative center position Y
Returns
value between 0 and 1 with 0.5 representing the center of the component
-
setBackgroundGradientRelativeY
public void setBackgroundGradientRelativeY(float backgroundGradientRelativeY) Background radial gradient relative center position Y
Parameters
backgroundGradientRelativeY: y position of the radial gradient center
-
getBackgroundGradientRelativeSize
public float getBackgroundGradientRelativeSize()Background radial gradient relative size
Returns
value representing the relative size of the gradient
-
setBackgroundGradientRelativeSize
public void setBackgroundGradientRelativeSize(float backgroundGradientRelativeSize) Background radial gradient relative size
Parameters
backgroundGradientRelativeSize: the size of the radial gradient
-
getFgColor
public int getFgColor()Foreground color for the component
Returns
the foreground color for the component
-
setFgColor
public final void setFgColor(int fgColor) Sets the foreground color for the component
Parameters
fgColor: foreground color
-
getFgAlpha
public int getFgAlpha()Foreground alpha for the component
Returns
the foreground alpha for the component
Since
8.0
-
setFgAlpha
public void setFgAlpha(int fgAlpha) Sets the foreground alpha for the component
Parameters
fgAlpha: foreground alpha
-
getFont
Font for the component
Returns
the font for the component
-
setFont
Sets the font for the component
Parameters
font: the font
-
setElevation
public void setElevation(int elevation, boolean override) Sets the elevation value. Valid values include 0, 1, 2, 3, 4, 6, 8, 9, 12, 16, and 24.
Parameters
-
elevation: The elevation value. -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
Since
8.0
-
-
setIconGap
public void setIconGap(float gap, byte units, boolean override) Sets the icon gap.
Parameters
-
gap: The gap. -
units: The units of the gap. -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
Since
8.0
See also
- #setIconGapUnit(byte, boolean)
-
-
setIconGap
public void setIconGap(float gap, boolean override) Sets the icon gap.
Parameters
-
gap: the icon gap. -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
Since
8.0
See also
- #setIconGapUnit(byte, boolean)
-
-
setIconGap
public void setIconGap(float gap, byte unit) Sets the icon gap.
Parameters
-
gap: The icon gap. -
unit: The unit. One of the standard style units of measurement.
Since
8.0
-
-
setIconGapUnit
public void setIconGapUnit(byte unit, boolean override) Sets the icon gap unit.
Parameters
-
unit: The icon gap unit. One of the standard style units of measurement. -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
Since
8.0
-
-
setSurface
public void setSurface(boolean surface, boolean override) Enables or disables surface rendering mode for component. Surfaces can support a sort of z-indexing of its descendants via their elevation properties. The surface will render the shadows of elevated descendants to convey depth.
Parameters
-
surface: True to enable surface rendering mode. -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
Since
8.0
-
-
setAlignment
public void setAlignment(int align, boolean override) Sets the Alignment of the Label to one of: CENTER, LEFT, RIGHT
Parameters
-
align: alignment value -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
See also
-
com.codename1.ui.Component#CENTER
-
com.codename1.ui.Component#LEFT
-
com.codename1.ui.Component#RIGHT
-
-
getAlignment
public int getAlignment()Returns the alignment of the Label
Returns
the alignment of the Label one of: CENTER, LEFT, RIGHT
See also
-
com.codename1.ui.Component#CENTER
-
com.codename1.ui.Component#LEFT
-
com.codename1.ui.Component#RIGHT
-
-
setAlignment
public void setAlignment(int align) Sets the Alignment of the Label to one of: CENTER, LEFT, RIGHT
Parameters
align: alignment value
See also
-
com.codename1.ui.Component#CENTER
-
com.codename1.ui.Component#LEFT
-
com.codename1.ui.Component#RIGHT
-
isUnderline
public boolean isUnderline()Returns true if the underline text decoration is on, false otherwise
Returns
true if the underline text decoration is on, false otherwise
-
setUnderline
public void setUnderline(boolean underline) Sets the underline text decoration for this style
Parameters
underline: true to turn underline on, false to turn it off
-
set3DText
public void set3DText(boolean t, boolean raised) Sets the 3D text decoration for this style
Parameters
-
t: true to turn 3d shadow effect on, false to turn it off -
raised: indicates a raised or lowered effect
-
-
is3DTextNorth
public boolean is3DTextNorth()Returns the text decoration state for the north
Returns
true if that is used
-
set3DTextNorth
public void set3DTextNorth(boolean north) Sets the text decoration to 3D text
Parameters
north: true to enable 3d text with the shadow on top false otherwise
-
isRaised3DText
public boolean isRaised3DText()Returns true if the 3D text decoration is on, false otherwise
Returns
true if the 3D text decoration is on, false otherwise
-
isLowered3DText
public boolean isLowered3DText()Returns true if the 3D text decoration is on, false otherwise
Returns
true if the 3D text decoration is on, false otherwise
-
isOverline
public boolean isOverline()Returns true if the overline text decoration is on, false otherwise
Returns
true if the overline text decoration is on, false otherwise
-
setOverline
public void setOverline(boolean overline) Sets the overline text decoration for this style
Parameters
overline: true to turn overline on, false to turn it off
-
isStrikeThru
public boolean isStrikeThru()Returns true if the strike through text decoration is on, false otherwise
Returns
true if the strike through text decoration is on, false otherwise
-
setStrikeThru
public void setStrikeThru(boolean strikethru) Sets the strike through text decoration for this style
Parameters
strikethru: true to turn strike through on, false to turn it off
-
getTextDecoration
public int getTextDecoration()Returns the text decoration of this style
Returns
the text decoration of this style (bitmask of the TEXT_DECORATION_* constants)
-
setTextDecoration
public void setTextDecoration(int textDecoration) Sets the text decoration of this style
Parameters
textDecoration: the textDecoration to set (bitmask of the TEXT_DECORATION_* constants)
-
setTextDecoration
public void setTextDecoration(int textDecoration, boolean override) Sets the text decoration of this style
Parameters
-
textDecoration: the textDecoration to set (bitmask of the TEXT_DECORATION_* constants) -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
getBgTransparency
public byte getBgTransparency()Returns the transparency (opacity) level of the Component, zero indicates fully transparent and FF indicates fully opaque.
Returns
the transparency level of the Component
-
setBgTransparency
public void setBgTransparency(byte transparency) Sets the Component transparency (opacity) level of the Component, zero indicates fully transparent and FF indicates fully opaque.
Parameters
transparency: transparency level as byte
-
setBgTransparency
public void setBgTransparency(int transparency) Sets the Component transparency level. Valid values should be a number between 0-255
Parameters
transparency: int value between 0-255
-
getOpacity
public int getOpacity()Returns the opacity value for the component
Returns
the opacity value
-
setOpacity
public final void setOpacity(int opacity) Set the opacity value
Parameters
opacity: the opacity value
-
setOpacity
public final void setOpacity(int opacity, boolean override) Sets the Component transparency level. Valid values should be a number between 0-255
Parameters
-
opacity: int value between 0-255 -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
stripMarginAndPadding
public void stripMarginAndPadding()Strips all margin and padding from this style.
Since
7.0
-
setPadding
public void setPadding(int top, int bottom, int left, int right) Sets the Style Padding. Units are specified by
#setPaddingUnit(byte...)Parameters
-
top: number of units to pad the top -
bottom: number of units to pad the bottom -
left: number of units to pad the left -
right: number of units to pad the right
See also
- #setPaddingUnit(byte...)
-
-
setPadding
public void setPadding(float top, float bottom, float left, float right) Sets the Style Padding. Units are specified by
#setPaddingUnit(byte...)Parameters
-
top: number of units to pad the top -
bottom: number of units to pad the bottom -
left: number of units to pad the left -
right: number of units to pad the right
See also
- #setPaddingUnit(byte...)
-
-
setPadding
public void setPadding(int orientation, int gap) Sets the Style Padding. Units are specified by
#setPaddingUnit(byte...)Parameters
-
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT -
gap: number of units to pad the orientation
-
-
setPadding
public void setPadding(int orientation, float gap) Sets the Style Padding. Units are specified by
#setPaddingUnit(byte...)Parameters
-
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT -
gap: number of units to pad the orientation
-
-
setMargin
public void setMargin(int top, int bottom, int left, int right) Sets the Style Margin
Parameters
-
top: number of margin using the current unit -
bottom: number of margin using the current unit -
left: number of margin using the current unit -
right: number of margin using the current unit
-
-
setMargin
public void setMargin(float top, float bottom, float left, float right) Sets the Style Margin
Parameters
-
top: number of margin using the current unit -
bottom: number of margin using the current unit -
left: number of margin using the current unit -
right: number of margin using the current unit
-
-
cacheMargins
public void cacheMargins(boolean override) Store current margin values into a cache that could be restored with restoreCachedMargins() -
restoreCachedMargins
public void restoreCachedMargins()Restore cached margins and flush the margins cache Warning: this method is used internally when unhidding a component with the Component.setHidden(false) method Do not use it on an hidden component or it would result into unexpected results when unhidding this component -
flushMarginsCache
public void flushMarginsCache()Flush the margins cache if one exists -
setMargin
public void setMargin(int orientation, int gap) Sets the Style Margin
Parameters
-
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT -
gap: number of margin using the current unit
-
-
setMargin
public void setMargin(int orientation, float gap) Sets the Style Margin
Parameters
-
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT -
gap: number of margin using the current unit
-
-
getPaddingValue
public int getPaddingValue(boolean rtl, int orientation) Returns the Padding in the internal value regardless of the unit
Parameters
-
rtl: flag indicating whether the padding is for an RTL bidi component -
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
amount of padding in the given orientation using current units.
Deprecated
Use
int)See also
- #getPaddingUnit()
-
-
getPaddingFloatValue
public float getPaddingFloatValue(boolean rtl, int orientation) Returns the Padding in the internal value regardless of the unit
Parameters
-
rtl: flag indicating whether the padding is for an RTL bidi component -
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
amount of padding in the given orientation using current units.
Since
8.0
See also
- #getPaddingUnit()
-
-
getPaddingLeft
public int getPaddingLeft(boolean rtl) Returns the left padding in pixel or right padding in an RTL situation
Parameters
rtl: indicates a right to left language
Returns
the padding in pixels
-
setPaddingUnitLeft
public void setPaddingUnitLeft(byte unit) Sets left padding unit.
Parameters
unit: @param unit One of of#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,#UNIT_TYPE_VMIN,#UNIT_TYPE_VMAX,#UNIT_TYPE_REM.
Since
7.0
-
setPaddingUnitRight
public void setPaddingUnitRight(byte unit) Sets right padding unit.
Parameters
unit: @param unit One of#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,#UNIT_TYPE_VMIN,#UNIT_TYPE_VMAX,#UNIT_TYPE_REM.
Since
7.0
-
setPaddingUnitTop
public void setPaddingUnitTop(byte unit) Sets top padding unit.
Parameters
unit: @param unit One of#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,#UNIT_TYPE_VMIN,#UNIT_TYPE_VMAX,#UNIT_TYPE_REM.
Since
7.0
-
setPaddingUnitBottom
public void setPaddingUnitBottom(byte unit) Sets bottom padding unit.
Parameters
unit: @param unit One of#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,#UNIT_TYPE_VMIN,#UNIT_TYPE_VMAX,#UNIT_TYPE_REM.
Since
7.0
-
getPaddingRight
public int getPaddingRight(boolean rtl) Returns the right padding in pixel or left padding in an RTL situation
Parameters
rtl: indicates a right to left language
Returns
the padding in pixels
-
getPaddingTop
public int getPaddingTop()Returns the top padding in pixel
Returns
the padding in pixels
-
setPaddingTop
public void setPaddingTop(int gap) Sets the Style Padding on the top, this is equivalent to calling
setPadding(Component.TOP, gap, false);Parameters
gap: amount to pad the top in current units.
See also
- #getPaddingUnit()
-
setPaddingTop
public void setPaddingTop(float gap) Sets the Style Padding on the top, this is equivalent to calling
setPadding(Component.TOP, gap, false);Parameters
gap: Amount to pad the top in current units.
See also
-
#getPaddingUnit()
-
#setPaddingUnit(byte...)
-
setPaddingLeft
public void setPaddingLeft(int gap) Sets the Style Padding on the left, this is equivalent to calling
setPadding(Component.LEFT, gap, false);Parameters
gap: Amount to pad the left in current units.
See also
-
#getPaddingUnit()
-
#setPaddingUnit(byte...)
-
setPaddingLeft
public void setPaddingLeft(float gap) Sets the Style Padding on the left, this is equivalent to calling
setPadding(Component.LEFT, gap, false);Parameters
gap: Amount to pad the left in current units.
See also
-
#getPaddingUnit()
-
#setPaddingUnit(byte...)
-
setPaddingRight
public void setPaddingRight(int gap) Sets the Style Padding on the right, this is equivalent to calling
setPadding(Component.RIGHT, gap, false);Parameters
gap: Amount to pad the right in current units.
See also
-
#getPaddingUnit()
-
#setPaddingUnit(byte...)
-
setPaddingRight
public void setPaddingRight(float gap) Sets the Style Padding on the right, this is equivalent to calling
setPadding(Component.RIGHT, gap, false);Parameters
gap: Amount to pad the right in current units.
See also
-
#getPaddingUnit()
-
#setPaddingUnit(byte...)
-
setMarginLeft
public void setMarginLeft(int gap) Sets the Style Margin on the left, this is equivalent to calling
setMargin(Component.LEFT, gap, false);Parameters
gap: number of left margin using the current unit
-
setMarginLeft
public void setMarginLeft(float gap) Sets the Style Margin on the left, this is equivalent to calling
setMargin(Component.LEFT, gap, false);Parameters
gap: number of left margin using the current unit
-
setMarginRight
public void setMarginRight(int gap) Sets the Style Margin on the right, this is equivalent to calling
setMargin(Component.RIGHT, gap, false);Parameters
gap: number of right margin using the current unit
-
setMarginRight
public void setMarginRight(float gap) Sets the Style Margin on the right, this is equivalent to calling
setMargin(Component.RIGHT, gap, false);Parameters
gap: number of right margin using the current unit
-
getPaddingBottom
public int getPaddingBottom()Returns the bottom padding in pixel
Returns
the padding in pixels
-
setPaddingBottom
public void setPaddingBottom(int gap) Sets the Style Padding on the bottom, this is equivalent to calling
setPadding(Component.BOTTOM, gap, false);Parameters
gap: Amount to pad the bottom in current units.
See also
-
#getPaddingUnit()
-
#setPaddingUnit(byte...)
-
setPaddingBottom
public void setPaddingBottom(float gap) Sets the Style Padding on the bottom, this is equivalent to calling
setPadding(Component.BOTTOM, gap, false);Parameters
gap: Amount to pad the bottom in current units.
See also
-
#getPaddingUnit()
-
#setPaddingUnit(byte...)
-
getHorizontalMargins
public int getHorizontalMargins()The equivalent of getMarginLeft + getMarginRight
Returns
the side margin
-
getVerticalMargins
public int getVerticalMargins()The equivalent of getMarginTop + getMarginBottom
Returns
the vertical margin
-
getHorizontalPadding
public int getHorizontalPadding()The equivalent of getPaddingLeft + getPaddingRight
Returns
the side padding
-
getVerticalPadding
public int getVerticalPadding()The equivalent of getPaddingTop + getPaddingBottom
Returns
the vertical padding
-
getMarginRightNoRTL
public int getMarginRightNoRTL()Returns the right margin in pixels ignoring RTL
Returns
the margin in pixels
-
getMarginLeftNoRTL
public int getMarginLeftNoRTL()Returns the left margin in pixels ignoring RTL
Returns
the margin in pixels
-
getPaddingRightNoRTL
public int getPaddingRightNoRTL()Returns the right padding in pixels ignoring RTL
Returns
the padding in pixels
-
getPaddingLeftNoRTL
public int getPaddingLeftNoRTL()Returns the left padding in pixels ignoring RTL
Returns
the padding in pixels
-
getMarginRight
public int getMarginRight(boolean rtl) Returns the right margin in pixel or left margin in an RTL situation
Parameters
rtl: indicates a right to left language
Returns
the margin in pixels
-
getMarginLeft
public int getMarginLeft(boolean rtl) Returns the left margin in pixel or right margin in an RTL situation
Parameters
rtl: indicates a right to left language
Returns
the margin in pixels
-
getMarginTop
public int getMarginTop()Returns the top margin in pixel
Returns
the margin in pixels
-
setMarginTop
public void setMarginTop(int gap) Sets the Style margin on the top, this is equivalent to calling
setMargin(Component.TOP, gap, false);Parameters
gap: number of top margin using the current unit
-
setMarginTop
public void setMarginTop(float gap) Sets the Style margin on the top, this is equivalent to calling
setMargin(Component.TOP, gap, false);Parameters
gap: number of top margin using the current unit
-
getMarginBottom
public int getMarginBottom()Returns the bottom margin in pixel
Returns
the margin in pixels
-
setMarginBottom
public void setMarginBottom(int gap) Sets the Style Margin on the bottom, this is equivalent to calling
setMargin(Component.BOTTOM, gap, false);Parameters
gap: number of bottom margin using the current unit
-
setMarginBottom
public void setMarginBottom(float gap) Sets the Style Margin on the bottom, this is equivalent to calling
setMargin(Component.BOTTOM, gap, false);Parameters
gap: number of bottom margin using the current unit
-
getPadding
public int getPadding(boolean rtl, int orientation) Returns the Padding in using the current unit
Parameters
-
rtl: flag indicating whether the padding is for an RTL bidi component -
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
number of padding pixels in the given orientation
-
-
getPadding
public int getPadding(int orientation) Returns the Padding
Parameters
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
number of padding pixels in the given orientation
-
getMargin
public int getMargin(int orientation) Returns the Margin
Parameters
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
number of margin using the current unit in the given orientation
-
getMargin
public int getMargin(boolean rtl, int orientation) Returns the Margin
Parameters
-
rtl: flag indicating whether the padding is for an RTL bidi component -
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
number of margin using the current unit in the given orientation
-
-
getMarginValue
public int getMarginValue(boolean rtl, int orientation) Returns the Margin
Parameters
-
rtl: flag indicating whether the padding is for an RTL bidi component -
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
number of margin using the current unit in the given orientation
Deprecated
Use
int) -
-
getMarginFloatValue
public float getMarginFloatValue(boolean rtl, int orientation) Returns the Margin
Parameters
-
rtl: flag indicating whether the padding is for an RTL bidi component -
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
number of margin using the current unit in the given orientation
Since
8.0
-
-
setBgColor
public void setBgColor(int bgColor, boolean override) Sets the background color for the component
Parameters
-
bgColor: RRGGBB color that ignores the alpha component -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setBgImage
Sets the background image for the component
Parameters
-
bgImage: background image -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setBackgroundType
public void setBackgroundType(byte backgroundType, boolean override) Sets the background type for the component
Parameters
-
backgroundType: @param backgroundType one of BACKGROUND_IMAGE_SCALED, BACKGROUND_IMAGE_TILE_BOTH, BACKGROUND_IMAGE_TILE_VERTICAL, BACKGROUND_IMAGE_TILE_HORIZONTAL, BACKGROUND_IMAGE_ALIGNED, BACKGROUND_GRADIENT_LINEAR_HORIZONTAL, BACKGROUND_GRADIENT_LINEAR_VERTICAL, BACKGROUND_GRADIENT_RADIAL -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setBackgroundGradientStartColor
public void setBackgroundGradientStartColor(int backgroundGradientStartColor, boolean override) Sets the background color for the component
Parameters
-
backgroundGradientStartColor: start color for the linear/radial gradient -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setBackgroundGradientEndColor
public void setBackgroundGradientEndColor(int backgroundGradientEndColor, boolean override) Sets the background color for the component
Parameters
-
backgroundGradientEndColor: end color for the linear/radial gradient -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setBackgroundGradientRelativeX
public void setBackgroundGradientRelativeX(float backgroundGradientRelativeX, boolean override) Background radial gradient relative center position X
Parameters
-
backgroundGradientRelativeX: x position of the radial gradient center -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setBackgroundGradientRelativeY
public void setBackgroundGradientRelativeY(float backgroundGradientRelativeY, boolean override) Background radial gradient relative center position Y
Parameters
-
backgroundGradientRelativeY: y position of the radial gradient center -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setBackgroundGradientRelativeSize
public void setBackgroundGradientRelativeSize(float backgroundGradientRelativeSize, boolean override) Background radial gradient relative size
Parameters
-
backgroundGradientRelativeSize: @param backgroundGradientRelativeSize the size of the radial gradient relative to the screens larger dimension -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setFgColor
public final void setFgColor(int fgColor, boolean override) Sets the foreground color for the component
Parameters
-
fgColor: foreground color -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setFgAlpha
public void setFgAlpha(int fgAlpha, boolean override) Sets the foreground alpha for the component
Parameters
-
fgAlpha: foreground alpha -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setFont
Sets the font for the component
Parameters
-
font: the font -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setBgTransparency
public void setBgTransparency(int transparency, boolean override) Sets the Component transparency level. Valid values should be a number between 0-255
Parameters
-
transparency: int value between 0-255 -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setPadding
public void setPadding(int orientation, int gap, boolean override) Sets the Style Padding
Parameters
-
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT -
gap: number of pixels to pad the orientation -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setPadding
public void setPadding(int orientation, float gap, boolean override) Sets the Style Padding
Parameters
-
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT -
gap: number of pixels to pad the orientation -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setMargin
public void setMargin(int orientation, int gap, boolean override) Sets the Style Margin
Parameters
-
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT -
gap: number of margin using the current unit -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
setMargin
public void setMargin(int orientation, float gap, boolean override) Sets the Style Margin
Parameters
-
orientation: one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT -
gap: number of margin using the current unit -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
isSuppressChangeEvents
public boolean isSuppressChangeEvents()Checks to see if change events are currently suppressed.
Returns
True if change events are suppressed.
Since
7.0
-
setSuppressChangeEvents
public void setSuppressChangeEvents(boolean suppress) Enables or disables events. Use this to temporarily suppress change events.
Parameters
suppress: True to suppress change events.
Since
7.0
-
addStyleListener
Adds a Style Listener to the Style Object.
Parameters
l: a style listener
-
removeStyleListener
Removes a Style Listener from the Style Object.
Parameters
l: a style listener
-
removeListeners
public void removeListeners()This method removes all Listeners from the Style -
setBorder
Sets the border for the style
Parameters
-
border: new border object for the component -
override: @param override If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
-
-
getBorder
Returns the border for the style
Returns
the border
-
setBorder
Sets the border for the style
Parameters
border: new border object for the component
-
getBgPainter
Return the background painter for this style, normally this would be the internal image/color painter but can be user defined
Returns
the background painter
-
setBgPainter
Defines the background painter for this style, normally this would be the internal image/color painter but can be user defined
Parameters
bgPainter: new painter to install into the style
-
getPaddingUnit
public byte[] getPaddingUnit()Indicates the units used for padding elements, if null pixels are used if not this is a 4 element array containing values of of
#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,#UNIT_TYPE_VMIN,#UNIT_TYPE_VMAX,#UNIT_TYPE_REM.
Returns
the paddingUnit
-
setPaddingUnit
public void setPaddingUnit(byte... paddingUnit) Indicates the units used for padding elements, if null pixels are used if not this is a 4 element array containing values of
#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,#UNIT_TYPE_VMIN,#UNIT_TYPE_VMAX,#UNIT_TYPE_REM.Parameters
paddingUnit: the paddingUnit to set
-
getMarginUnit
public byte[] getMarginUnit()Indicates the units used for margin elements, if null pixels are used if not this is a 4 element array containing values of of
#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,#UNIT_TYPE_VMIN,#UNIT_TYPE_VMAX,#UNIT_TYPE_REM.
Returns
the marginUnit
-
setMarginUnit
public void setMarginUnit(byte... marginUnit) Indicates the units used for margin elements, if null pixels are used if not this is a 4 element array containing values of of
#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,#UNIT_TYPE_VMIN,#UNIT_TYPE_VMAX,#UNIT_TYPE_REM.
Parameters
marginUnit: the marginUnit to set
-
setMarginUnitLeft
public void setMarginUnitLeft(byte unit) Sets left margin unit.
Parameters
unit: @param unit One of#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,#UNIT_TYPE_VMIN,#UNIT_TYPE_VMAX,#UNIT_TYPE_REM.
Since
7.0
-
setMarginUnitRight
public void setMarginUnitRight(byte unit) Sets right margin unit.
Parameters
unit: @param unit One of#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,#UNIT_TYPE_VMIN,#UNIT_TYPE_VMAX,#UNIT_TYPE_REM.
Since
7.0
-
setMarginUnitTop
public void setMarginUnitTop(byte unit) Sets top margin unit.
Parameters
unit: @param unit One of#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,#UNIT_TYPE_VMIN,#UNIT_TYPE_VMAX,#UNIT_TYPE_REM.
Since
7.0
-
setMarginUnitBottom
public void setMarginUnitBottom(byte unit) Sets bottom margin unit.
Parameters
unit: @param unit One of#UNIT_TYPE_PIXELS,#UNIT_TYPE_DIPS,#UNIT_TYPE_SCREEN_PERCENTAGE,#UNIT_TYPE_VW,#UNIT_TYPE_VH,#UNIT_TYPE_VMIN,#UNIT_TYPE_VMAX,#UNIT_TYPE_REM.
Since
7.0
-
equals
-
hashCode
-