public class Style
- Object
- 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.
Fields
public static final String BG_COLOR = "bgColor" | Background color attribute name for the theme hashtable |
public static final String FG_COLOR = "fgColor" | Foreground color attribute name for the theme hashtable |
public static final String FG_ALPHA = "fgAlpha" | Foreground alpha attribute name for the theme hashtable |
public static final String BG_IMAGE = "bgImage" | Background image attribute name for the theme hashtable |
public static final String BACKGROUND_TYPE = "bgType" | Background attribute name for the theme hashtable |
public static final String BACKGROUND_ALIGNMENT = "bgAlign" | Background attribute name for the theme hashtable |
public static final String BACKGROUND_GRADIENT = "bgGradient" | Background attribute name for the theme hashtable |
public static final String GRADIENT = "bgGradientEx" | Extended gradient attribute (multi-stop, angled, conic, repeating). |
public static final String FILTER_BLUR = "filterBlur" | CSS filter:blur() radius in pixels. |
public static final String BACKDROP_FILTER_BLUR = "backdropFilterBlur" | CSS backdrop-filter:blur() radius in pixels. |
public static final String FILTER_COLOR_MATRIX = "filterColorMatrix" | CSS filter: 4x5 color matrix (composed from brightness, contrast, grayscale, hue-rotate, invert, opacity, saturate, sepia). |
public static final String BACKDROP_FILTER_COLOR_MATRIX = "backdropFilterColorMatrix" | CSS backdrop-filter color matrix (same layout as FILTER_COLOR_MATRIX). |
public static final String FONT = "font" | Font attribute name for the theme hashtable |
public static final String TRANSPARENCY = "transparency" | Transparency attribute name for the theme hashtable |
public static final String OPACITY = "opacity" | Opacity attribute name for the theme hashtable |
public static final String ELEVATION = "elevation" | Elevation attribute name for the theme hashtable. |
public static final String LETTER_SPACING = "letterSpacing" | Letter spacing attribute name for the theme hashtable. |
public static final String ICON_GAP = "iconGap" | Icon gap attribute name for the theme hashtable. |
public static final String ICON_GAP_UNIT = "iconGapUnit" | Icon gap unit attribute. |
public static final String SURFACE = "surface" | Surface attribute name for the theme hashtable. |
public static final String MARGIN = "margin" | Margin attribute name for the theme hashtable |
public static final String BORDER = "border" | Border attribute name for the theme hashtable |
public static final String PADDING = "padding" | Padding attribute name for the theme hashtable |
public static final String PAINTER = "painter" | Painter attribute name for the style event |
public static final String ALIGNMENT = "align" | Alignment attribute for the style event |
public static final String TEXT_DECORATION = "textDecoration" | Text decoration attribute for the style event |
public static final String PADDING_UNIT = "padUnit" | The units of the padding |
public static final String MARGIN_UNIT = "marUnit" | The units of the margin |
public static final byte BACKGROUND_NONE = 0 | Indicates the background for the style would use a scaled image |
public static final byte BACKGROUND_IMAGE_SCALED = 1 | Indicates the background for the style would use a scaled image |
public static final byte BACKGROUND_IMAGE_TILE_BOTH = 2 | Indicates the background for the style would use a tiled image on both axis |
public static final byte BACKGROUND_IMAGE_TILE_VERTICAL = 3 | Indicates the background for the style would use a vertical tiled image |
public static final byte BACKGROUND_IMAGE_TILE_HORIZONTAL = 4 | Indicates the background for the style would use a horizontal tiled image |
public static final byte BACKGROUND_IMAGE_ALIGNED_TOP = 20 | Indicates the background for the style would use an unscaled image with an alignment |
public static final byte BACKGROUND_IMAGE_ALIGNED_BOTTOM = 21 | Indicates the background for the style would use an unscaled image with an alignment |
public static final byte BACKGROUND_IMAGE_ALIGNED_LEFT = 22 | Indicates the background for the style would use an unscaled image with an alignment |
public static final byte BACKGROUND_IMAGE_ALIGNED_RIGHT = 23 | Indicates the background for the style would use an unscaled image with an alignment |
public static final byte BACKGROUND_IMAGE_ALIGNED_CENTER = 24 | Indicates the background for the style would use an unscaled image with an alignment |
public static final byte BACKGROUND_IMAGE_ALIGNED_TOP_LEFT = 25 | Indicates the background for the style would use an unscaled image with an alignment |
public static final byte BACKGROUND_IMAGE_ALIGNED_TOP_RIGHT = 26 | Indicates the background for the style would use an unscaled image with an alignment |
public static final byte BACKGROUND_IMAGE_ALIGNED_BOTTOM_LEFT = 27 | Indicates the background for the style would use an unscaled image with an alignment |
public static final byte BACKGROUND_IMAGE_ALIGNED_BOTTOM_RIGHT = 28 | Indicates the background for the style would use an unscaled image with an alignment |
public static final byte BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_TOP = 4 | Indicates the background for the style would use a horizontal tiled image |
public static final byte BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_CENTER = 29 | Indicates the background for the style would use a horizontal tiled image |
public static final byte BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_BOTTOM = 30 | Indicates the background for the style would use a horizontal tiled image |
public static final byte BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_LEFT = 3 | Indicates the background for the style would use a horizontal tiled image |
public static final byte BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_CENTER = 31 | Indicates the background for the style would use a horizontal tiled image |
public static final byte BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_RIGHT = 32 | Indicates the background for the style would use a horizontal tiled image |
public static final byte BACKGROUND_IMAGE_SCALED_FILL = 33 | Indicates the background for the style would use a scaled image that fills all available space while maintaining aspect ratio |
public static final byte BACKGROUND_IMAGE_SCALED_FIT = 34 | Indicates the background for the style would use a scaled image that fits to available space while maintaining aspect ratio |
public static final byte BACKGROUND_GRADIENT_LINEAR_VERTICAL = 6 | Indicates the background for the style would use a linear gradient |
public static final byte BACKGROUND_GRADIENT_LINEAR_HORIZONTAL = 7 | Indicates the background for the style would use a linear gradient |
public static final byte BACKGROUND_GRADIENT_RADIAL = 8 | Indicates the background for the style would use a radial gradient |
public static final byte BACKGROUND_GRADIENT_LINEAR = 35 | Multi-stop linear gradient at an arbitrary angle. |
public static final byte BACKGROUND_GRADIENT_RADIAL_FULL = 36 | Multi-stop radial gradient with full CSS shape/extent control. |
public static final byte BACKGROUND_GRADIENT_CONIC = 37 | Conic / sweep gradient. |
public static final byte BACKGROUND_GRADIENT_REPEATING_LINEAR = 38 | Repeating multi-stop linear gradient (CSS repeating-linear-gradient). |
public static final byte BACKGROUND_GRADIENT_REPEATING_RADIAL = 39 | Repeating multi-stop radial gradient (CSS repeating-radial-gradient). |
public static final byte TEXT_DECORATION_NONE = 0 | Indicates no text decoration |
public static final byte TEXT_DECORATION_UNDERLINE = 1 | Indicates underline |
public static final byte TEXT_DECORATION_STRIKETHRU = 2 | Indicates a strike-through line (usually used to denote deleted text) |
public static final byte TEXT_DECORATION_OVERLINE = 4 | Indicates overline |
public static final byte TEXT_DECORATION_3D = 8 | 3D text effect using a font shadow |
public static final byte TEXT_DECORATION_3D_LOWERED = 16 | 3D sunken text effect using a light font shadow |
public static final byte TEXT_DECORATION_3D_SHADOW_NORTH = 32 | 3D text effect using a font shadow |
public static final byte UNIT_TYPE_PIXELS = 0 | Indicates the unit type for padding/margin, the default is in device specific pixels |
public static final byte UNIT_TYPE_SCREEN_PERCENTAGE = 1 | Indicates the unit type for padding/margin in percentage of the size of the screen |
public static final byte UNIT_TYPE_DIPS = 2 | Indicates the unit type for padding/margin in device independent pixels. |
public static final byte UNIT_TYPE_VW = 3 | Indicates the unit type for padding/margin as a percentage of the screen width. |
public static final byte UNIT_TYPE_VH = 4 | Indicates the unit type for padding/margin as a percentage of the screen height. |
public static final byte UNIT_TYPE_VMIN = 5 | Indicates the unit type for padding/margin as a percentage the minimum of screen width and height. |
public static final byte UNIT_TYPE_VMAX = 6 | Indicates the unit type for padding/margin as a percentage the maximum of screen width and height. |
public static final byte UNIT_TYPE_REM = 7 | Indicates the unit type for padding/margin relative to the font size of the default font. |
Constructors
public Style() | Each component when it draw itself uses this Object to determine in what colors it should use. |
public Style(Style style) | Creates a full copy of the given style. |
public Style(int fgColor, int bgColor, Font f, byte transparency) | Creates a new style with the given attributes |
public Style(int fgColor, int bgColor, Font f, byte transparency, Image im, byte backgroundType) | Creates a new style with the given attributes |
Methods
public static Style createProxyStyle(Style... styles) | Creates a “proxy” style whose setter methods map to the methods in the given styles passed and whose getter methods are meaningless |
public void markAsRendererStyle() | Disables native OS optimizations that might collide with cell renderers which do things like sharing style objects |
public boolean isRendererStyle() | Indicates whether this style has been marked for use with renderers. |
public void merge(Style style) | Merges the new style with the current style without changing the elements that were modified. |
public int getElevation() | Gets the elevation value of this style. |
public void setElevation(int elevation) | Sets the elevation value. |
public int getIconGap() | Returns the icon gap in pixels. |
public float getLetterSpacing() | Returns the letter spacing (in EM units, font-size relative) applied to text drawn with this style. |
public void setLetterSpacing(float letterSpacing) | Sets the letter spacing in EM units (font-size relative). |
public void setLetterSpacing(float spacing, boolean override) | Sets the letter spacing in EM units. |
public void setIconGap(float gap) | Sets the icon gap in the current units. |
public int getIconGapUnit() | Returns the icon gap unit. |
public void setIconGapUnit(byte unit) | Sets the icon gap unit. |
public boolean isSurface() | Checks whether the component is a surface. |
public void setSurface(boolean surface) | Enables or disables surface rendering mode for component. |
public boolean isModified() | Returns true if the style was modified manually after it was created by the look and feel. |
public int getBgColor() | Background color for the component |
public void setBgColor(int bgColor) | Sets the background color for the component |
public Image getBgImage() | Background image for the component |
public void setBgImage(Image bgImage) | Sets the background image for the component |
public byte getBackgroundType() | The type of the background defaults to BACKGROUND_IMAGE_SCALED |
public void setBackgroundType(byte backgroundType) | Sets the background type for the component |
public int getBackgroundGradientStartColor() | Start color for the radial/linear gradient |
public void setBackgroundGradientStartColor(int backgroundGradientStartColor) | Sets the background color for the component |
public int getBackgroundGradientEndColor() | End color for the radial/linear gradient |
public void setBackgroundGradientEndColor(int backgroundGradientEndColor) | Sets the background color for the component |
public float getBackgroundGradientRelativeX() | Background radial gradient relative center position X |
public void setBackgroundGradientRelativeX(float backgroundGradientRelativeX) | Background radial gradient relative center position X |
public float getBackgroundGradientRelativeY() | Background radial gradient relative center position Y |
public void setBackgroundGradientRelativeY(float backgroundGradientRelativeY) | Background radial gradient relative center position Y |
public float getBackgroundGradientRelativeSize() | Background radial gradient relative size |
public void setBackgroundGradientRelativeSize(float backgroundGradientRelativeSize) | Background radial gradient relative size |
public int getFgColor() | Foreground color for the component |
public final void setFgColor(int fgColor) | Sets the foreground color for the component |
public int getFgAlpha() | Foreground alpha for the component |
public void setFgAlpha(int fgAlpha) | Sets the foreground alpha for the component |
public Font getFont() | Font for the component |
public void setFont(Font font) | Sets the font for the component |
public void setElevation(int elevation, boolean override) | Sets the elevation value. |
public void setIconGap(float gap, byte units, boolean override) | Sets the icon gap. |
public void setIconGap(float gap, boolean override) | Sets the icon gap. |
public void setIconGap(float gap, byte unit) | Sets the icon gap. |
public void setIconGapUnit(byte unit, boolean override) | Sets the icon gap unit. |
public void setSurface(boolean surface, boolean override) | Enables or disables surface rendering mode for component. |
public void setAlignment(int align, boolean override) | Sets the Alignment of the Label to one of: CENTER, LEFT, RIGHT |
public int getAlignment() | Returns the alignment of the Label |
public void setAlignment(int align) | Sets the Alignment of the Label to one of: CENTER, LEFT, RIGHT |
public boolean isUnderline() | Returns true if the underline text decoration is on, false otherwise |
public void setUnderline(boolean underline) | Sets the underline text decoration for this style |
public void set3DText(boolean t, boolean raised) | Sets the 3D text decoration for this style |
public boolean is3DTextNorth() | Returns the text decoration state for the north |
public void set3DTextNorth(boolean north) | Sets the text decoration to 3D text |
public boolean isRaised3DText() | Returns true if the 3D text decoration is on, false otherwise |
public boolean isLowered3DText() | Returns true if the 3D text decoration is on, false otherwise |
public boolean isOverline() | Returns true if the overline text decoration is on, false otherwise |
public void setOverline(boolean overline) | Sets the overline text decoration for this style |
public boolean isStrikeThru() | Returns true if the strike through text decoration is on, false otherwise |
public void setStrikeThru(boolean strikethru) | Sets the strike through text decoration for this style |
public int getTextDecoration() | Returns the text decoration of this style |
public void setTextDecoration(int textDecoration) | Sets the text decoration of this style |
public void setTextDecoration(int textDecoration, boolean override) | Sets the text decoration of this style |
public byte getBgTransparency() | Returns the transparency (opacity) level of the Component, zero indicates fully transparent and FF indicates fully opaque. |
public void setBgTransparency(byte transparency) | Sets the Component transparency (opacity) level of the Component, zero indicates fully transparent and FF indicates fully opaque. |
public void setBgTransparency(int transparency) | Sets the Component transparency level. |
public int getOpacity() | Returns the opacity value for the component |
public final void setOpacity(int opacity) | Set the opacity value |
public final void setOpacity(int opacity, boolean override) | Sets the Component transparency level. |
public void stripMarginAndPadding() | Strips all margin and padding from this style. |
public void setPadding(int top, int bottom, int left, int right) | Sets the Style Padding. |
public void setPadding(float top, float bottom, float left, float right) | Sets the Style Padding. |
public void setPadding(int orientation, int gap) | Sets the Style Padding. |
public void setPadding(int orientation, float gap) | Sets the Style Padding. |
public void setMargin(int top, int bottom, int left, int right) | Sets the Style Margin |
public void setMargin(float top, float bottom, float left, float right) | Sets the Style Margin |
public void cacheMargins(boolean override) | Store current margin values into a cache that could be restored with 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… |
public void flushMarginsCache() | Flush the margins cache if one exists |
public void setMargin(int orientation, int gap) | Sets the Style Margin |
public void setMargin(int orientation, float gap) | Sets the Style Margin |
public int getPaddingValue(boolean rtl, int orientation) | Deprecated Returns the Padding in the internal value regardless of the unit |
public float getPaddingFloatValue(boolean rtl, int orientation) | Returns the Padding in the internal value regardless of the unit |
public int getPaddingLeft(boolean rtl) | Returns the left padding in pixel or right padding in an RTL situation |
public void setPaddingUnitLeft(byte unit) | Sets left padding unit. |
public void setPaddingUnitRight(byte unit) | Sets right padding unit. |
public void setPaddingUnitTop(byte unit) | Sets top padding unit. |
public void setPaddingUnitBottom(byte unit) | Sets bottom padding unit. |
public int getPaddingRight(boolean rtl) | Returns the right padding in pixel or left padding in an RTL situation |
public int getPaddingTop() | Returns the top padding in pixel |
public void setPaddingTop(int gap) | Sets the Style Padding on the top, this is equivalent to calling setPadding(Component.TOP, gap, false); |
public void setPaddingTop(float gap) | Sets the Style Padding on the top, this is equivalent to calling setPadding(Component.TOP, gap, false); |
public void setPaddingLeft(int gap) | Sets the Style Padding on the left, this is equivalent to calling setPadding(Component.LEFT, gap, false); |
public void setPaddingLeft(float gap) | Sets the Style Padding on the left, this is equivalent to calling setPadding(Component.LEFT, gap, false); |
public void setPaddingRight(int gap) | Sets the Style Padding on the right, this is equivalent to calling setPadding(Component.RIGHT, gap, false); |
public void setPaddingRight(float gap) | Sets the Style Padding on the right, this is equivalent to calling setPadding(Component.RIGHT, gap, false); |
public void setMarginLeft(int gap) | Sets the Style Margin on the left, this is equivalent to calling setMargin(Component.LEFT, gap, false); |
public void setMarginLeft(float gap) | Sets the Style Margin on the left, this is equivalent to calling setMargin(Component.LEFT, gap, false); |
public void setMarginRight(int gap) | Sets the Style Margin on the right, this is equivalent to calling setMargin(Component.RIGHT, gap, false); |
public void setMarginRight(float gap) | Sets the Style Margin on the right, this is equivalent to calling setMargin(Component.RIGHT, gap, false); |
public int getPaddingBottom() | Returns the bottom padding in pixel |
public void setPaddingBottom(int gap) | Sets the Style Padding on the bottom, this is equivalent to calling setPadding(Component.BOTTOM, gap, false); |
public void setPaddingBottom(float gap) | Sets the Style Padding on the bottom, this is equivalent to calling setPadding(Component.BOTTOM, gap, false); |
public int getHorizontalMargins() | The equivalent of getMarginLeft + getMarginRight |
public int getVerticalMargins() | The equivalent of getMarginTop + getMarginBottom |
public int getHorizontalPadding() | The equivalent of getPaddingLeft + getPaddingRight |
public int getVerticalPadding() | The equivalent of getPaddingTop + getPaddingBottom |
public int getMarginRightNoRTL() | Returns the right margin in pixels ignoring RTL |
public int getMarginLeftNoRTL() | Returns the left margin in pixels ignoring RTL |
public int getPaddingRightNoRTL() | Returns the right padding in pixels ignoring RTL |
public int getPaddingLeftNoRTL() | Returns the left padding in pixels ignoring RTL |
public int getMarginRight(boolean rtl) | Returns the right margin in pixel or left margin in an RTL situation |
public int getMarginLeft(boolean rtl) | Returns the left margin in pixel or right margin in an RTL situation |
public int getMarginTop() | Returns the top margin in pixel |
public void setMarginTop(int gap) | Sets the Style margin on the top, this is equivalent to calling setMargin(Component.TOP, gap, false); |
public void setMarginTop(float gap) | Sets the Style margin on the top, this is equivalent to calling setMargin(Component.TOP, gap, false); |
public int getMarginBottom() | Returns the bottom margin in pixel |
public void setMarginBottom(int gap) | Sets the Style Margin on the bottom, this is equivalent to calling setMargin(Component.BOTTOM, gap, false); |
public void setMarginBottom(float gap) | Sets the Style Margin on the bottom, this is equivalent to calling setMargin(Component.BOTTOM, gap, false); |
public int getPadding(boolean rtl, int orientation) | Returns the Padding in using the current unit |
public int getPadding(int orientation) | Returns the Padding |
public int getMargin(int orientation) | Returns the Margin |
public int getMargin(boolean rtl, int orientation) | Returns the Margin |
public int getMarginValue(boolean rtl, int orientation) | Deprecated Returns the Margin |
public float getMarginFloatValue(boolean rtl, int orientation) | Returns the Margin |
public void setBgColor(int bgColor, boolean override) | Sets the background color for the component |
public void setBgImage(Image bgImage, boolean override) | Sets the background image for the component |
public void setBackgroundType(byte backgroundType, boolean override) | Sets the background type for the component |
public void setBackgroundGradientStartColor(int backgroundGradientStartColor, boolean override) | Sets the background color for the component |
public void setBackgroundGradientEndColor(int backgroundGradientEndColor, boolean override) | Sets the background color for the component |
public void setBackgroundGradientRelativeX(float backgroundGradientRelativeX, boolean override) | Background radial gradient relative center position X |
public void setBackgroundGradientRelativeY(float backgroundGradientRelativeY, boolean override) | Background radial gradient relative center position Y |
public void setBackgroundGradientRelativeSize(float backgroundGradientRelativeSize, boolean override) | Background radial gradient relative size |
public Gradient getGradient() | Extended (multi-stop / angled / conic / repeating) gradient backing BACKGROUND_GRADIENT_LINEAR / BACKGROUND_GRADIENT_RADIAL_FULL / BACKGROUND_GRADIENT_CONIC / BACKGROUND_GRADIENT_REPEATING_*. |
public void setGradient(Gradient gradient) | Sets the extended gradient. |
public void setGradient(Gradient gradient, boolean override) | Internal setter variant honoring the override flag. |
public float getFilterBlurRadius() | CSS filter:blur() radius applied to the component’s foreground (the component itself, after it has been painted). |
public void setFilterBlurRadius(float radius) | |
public void setFilterBlurRadius(float radius, boolean override) | |
public float getBackdropFilterBlurRadius() | CSS backdrop-filter:blur() radius applied to whatever is painted behind the component before this component is drawn. |
public void setBackdropFilterBlurRadius(float radius) | |
public void setBackdropFilterBlurRadius(float radius, boolean override) | |
public float[] getFilterColorMatrix() | CSS filter color-matrix: 4x5 row-major float[20] composed from brightness / contrast / grayscale / hue-rotate / invert / opacity / saturate / sepia. |
public void setFilterColorMatrix(float[] matrix) | |
public void setFilterColorMatrix(float[] matrix, boolean override) | |
public float[] getBackdropFilterColorMatrix() | CSS backdrop-filter color-matrix; same layout as filterColorMatrix but applied to whatever is painted behind the component. |
public void setBackdropFilterColorMatrix(float[] matrix) | |
public void setBackdropFilterColorMatrix(float[] matrix, boolean override) | |
public boolean isExtendedGradientBackground() | Returns true when the backgroundType requires the extended gradient descriptor (i.e. legacy 2-color start/end accessors are not sufficient). |
public final void setFgColor(int fgColor, boolean override) | Sets the foreground color for the component |
public void setFgAlpha(int fgAlpha, boolean override) | Sets the foreground alpha for the component |
public void setFont(Font font, boolean override) | Sets the font for the component |
public void setBgTransparency(int transparency, boolean override) | Sets the Component transparency level. |
public void setPadding(int orientation, int gap, boolean override) | Sets the Style Padding |
public void setPadding(int orientation, float gap, boolean override) | Sets the Style Padding |
public void setMargin(int orientation, int gap, boolean override) | Sets the Style Margin |
public void setMargin(int orientation, float gap, boolean override) | Sets the Style Margin |
public boolean isSuppressChangeEvents() | Checks to see if change events are currently suppressed. |
public void setSuppressChangeEvents(boolean suppress) | Enables or disables events. |
public void addStyleListener(StyleListener l) | Adds a Style Listener to the Style Object. |
public void removeStyleListener(StyleListener l) | Removes a Style Listener from the Style Object. |
public void removeListeners() | This method removes all Listeners from the Style |
public void setBorder(Border border, boolean override) | Sets the border for the style |
public Border getBorder() | Returns the border for the style |
public void setBorder(Border border) | Sets the border for the style |
public Painter getBgPainter() | Return the background painter for this style, normally this would be the internal image/color painter but can be user defined |
public void setBgPainter(Painter bgPainter) | Defines the background painter for this style, normally this would be the internal image/color painter but can be user defined |
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. |
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. |
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. |
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. |
public void setMarginUnitLeft(byte unit) | Sets left margin unit. |
public void setMarginUnitRight(byte unit) | Sets right margin unit. |
public void setMarginUnitTop(byte unit) | Sets top margin unit. |
public void setMarginUnitBottom(byte unit) | Sets bottom margin unit. |
public boolean equals(Object obj) | Indicates whether some other object is “equal to” this one. |
public int hashCode() | Returns a hash code value for the object. |
Inherited methods
Field details
BG_COLOR
public static final String BG_COLOR = "bgColor"FG_COLOR
public static final String FG_COLOR = "fgColor"FG_ALPHA
public static final String FG_ALPHA = "fgAlpha"BG_IMAGE
public static final String BG_IMAGE = "bgImage"BACKGROUND_TYPE
public static final String BACKGROUND_TYPE = "bgType"BACKGROUND_ALIGNMENT
public static final String BACKGROUND_ALIGNMENT = "bgAlign"BACKGROUND_GRADIENT
public static final String BACKGROUND_GRADIENT = "bgGradient"GRADIENT
public static final String GRADIENT = "bgGradientEx"FILTER_BLUR
public static final String FILTER_BLUR = "filterBlur"BACKDROP_FILTER_BLUR
public static final String BACKDROP_FILTER_BLUR = "backdropFilterBlur"FILTER_COLOR_MATRIX
public static final String FILTER_COLOR_MATRIX = "filterColorMatrix"brightness,
contrast, grayscale, hue-rotate, invert, opacity, saturate,
sepia). Stored as row-major float[20] - [R,G,B,A] x [R,G,B,A,offset].
Offset column is in 0-255 RGB space.BACKDROP_FILTER_COLOR_MATRIX
public static final String BACKDROP_FILTER_COLOR_MATRIX = "backdropFilterColorMatrix"FONT
public static final String FONT = "font"TRANSPARENCY
public static final String TRANSPARENCY = "transparency"OPACITY
public static final String OPACITY = "opacity"ELEVATION
public static final String ELEVATION = "elevation"LETTER_SPACING
public static final String LETTER_SPACING = "letterSpacing"ICON_GAP
public static final String ICON_GAP = "iconGap"ICON_GAP_UNIT
public static final String ICON_GAP_UNIT = "iconGapUnit"SURFACE
public static final String SURFACE = "surface"MARGIN
public static final String MARGIN = "margin"BORDER
public static final String BORDER = "border"PADDING
public static final String PADDING = "padding"PAINTER
public static final String PAINTER = "painter"ALIGNMENT
public static final String ALIGNMENT = "align"TEXT_DECORATION
public static final String TEXT_DECORATION = "textDecoration"PADDING_UNIT
public static final String PADDING_UNIT = "padUnit"MARGIN_UNIT
public static final String MARGIN_UNIT = "marUnit"BACKGROUND_NONE
public static final byte BACKGROUND_NONE = 0BACKGROUND_IMAGE_SCALED
public static final byte BACKGROUND_IMAGE_SCALED = 1BACKGROUND_IMAGE_TILE_BOTH
public static final byte BACKGROUND_IMAGE_TILE_BOTH = 2BACKGROUND_IMAGE_TILE_VERTICAL
public static final byte BACKGROUND_IMAGE_TILE_VERTICAL = 3BACKGROUND_IMAGE_TILE_HORIZONTAL
public static final byte BACKGROUND_IMAGE_TILE_HORIZONTAL = 4BACKGROUND_IMAGE_ALIGNED_TOP
public static final byte BACKGROUND_IMAGE_ALIGNED_TOP = 20BACKGROUND_IMAGE_ALIGNED_BOTTOM
public static final byte BACKGROUND_IMAGE_ALIGNED_BOTTOM = 21BACKGROUND_IMAGE_ALIGNED_LEFT
public static final byte BACKGROUND_IMAGE_ALIGNED_LEFT = 22BACKGROUND_IMAGE_ALIGNED_RIGHT
public static final byte BACKGROUND_IMAGE_ALIGNED_RIGHT = 23BACKGROUND_IMAGE_ALIGNED_CENTER
public static final byte BACKGROUND_IMAGE_ALIGNED_CENTER = 24BACKGROUND_IMAGE_ALIGNED_TOP_LEFT
public static final byte BACKGROUND_IMAGE_ALIGNED_TOP_LEFT = 25BACKGROUND_IMAGE_ALIGNED_TOP_RIGHT
public static final byte BACKGROUND_IMAGE_ALIGNED_TOP_RIGHT = 26BACKGROUND_IMAGE_ALIGNED_BOTTOM_LEFT
public static final byte BACKGROUND_IMAGE_ALIGNED_BOTTOM_LEFT = 27BACKGROUND_IMAGE_ALIGNED_BOTTOM_RIGHT
public static final byte BACKGROUND_IMAGE_ALIGNED_BOTTOM_RIGHT = 28BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_TOP
public static final byte BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_TOP = 4BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_CENTER
public static final byte BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_CENTER = 29BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_BOTTOM
public static final byte BACKGROUND_IMAGE_TILE_HORIZONTAL_ALIGN_BOTTOM = 30BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_LEFT
public static final byte BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_LEFT = 3BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_CENTER
public static final byte BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_CENTER = 31BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_RIGHT
public static final byte BACKGROUND_IMAGE_TILE_VERTICAL_ALIGN_RIGHT = 32BACKGROUND_IMAGE_SCALED_FILL
public static final byte BACKGROUND_IMAGE_SCALED_FILL = 33BACKGROUND_IMAGE_SCALED_FIT
public static final byte BACKGROUND_IMAGE_SCALED_FIT = 34BACKGROUND_GRADIENT_LINEAR_VERTICAL
public static final byte BACKGROUND_GRADIENT_LINEAR_VERTICAL = 6BACKGROUND_GRADIENT_LINEAR_HORIZONTAL
public static final byte BACKGROUND_GRADIENT_LINEAR_HORIZONTAL = 7BACKGROUND_GRADIENT_RADIAL
public static final byte BACKGROUND_GRADIENT_RADIAL = 8BACKGROUND_GRADIENT_LINEAR
public static final byte BACKGROUND_GRADIENT_LINEAR = 35BACKGROUND_GRADIENT_RADIAL_FULL
public static final byte BACKGROUND_GRADIENT_RADIAL_FULL = 36BACKGROUND_GRADIENT_CONIC
public static final byte BACKGROUND_GRADIENT_CONIC = 37BACKGROUND_GRADIENT_REPEATING_LINEAR
public static final byte BACKGROUND_GRADIENT_REPEATING_LINEAR = 38BACKGROUND_GRADIENT_REPEATING_RADIAL
public static final byte BACKGROUND_GRADIENT_REPEATING_RADIAL = 39TEXT_DECORATION_NONE
public static final byte TEXT_DECORATION_NONE = 0TEXT_DECORATION_UNDERLINE
public static final byte TEXT_DECORATION_UNDERLINE = 1TEXT_DECORATION_STRIKETHRU
public static final byte TEXT_DECORATION_STRIKETHRU = 2TEXT_DECORATION_OVERLINE
public static final byte TEXT_DECORATION_OVERLINE = 4TEXT_DECORATION_3D
public static final byte TEXT_DECORATION_3D = 8TEXT_DECORATION_3D_LOWERED
public static final byte TEXT_DECORATION_3D_LOWERED = 16TEXT_DECORATION_3D_SHADOW_NORTH
public static final byte TEXT_DECORATION_3D_SHADOW_NORTH = 32UNIT_TYPE_PIXELS
public static final byte UNIT_TYPE_PIXELS = 0UNIT_TYPE_SCREEN_PERCENTAGE
public static final byte UNIT_TYPE_SCREEN_PERCENTAGE = 1UNIT_TYPE_DIPS
public static final byte UNIT_TYPE_DIPS = 2UNIT_TYPE_VW
public static final byte UNIT_TYPE_VW = 3UNIT_TYPE_VH
public static final byte UNIT_TYPE_VH = 4UNIT_TYPE_VMIN
public static final byte UNIT_TYPE_VMIN = 5UNIT_TYPE_VMAX
public static final byte UNIT_TYPE_VMAX = 6UNIT_TYPE_REM
public static final byte UNIT_TYPE_REM = 7Constructor details
Style
public Style()Style
public Style(Style style)Parameters
styleStyle- the style to copy
Style
public Style(int fgColor, int bgColor, Font f, byte transparency)Parameters
fgColorint- foreground color
bgColorint- background color
fFont- font
transparencybyte- transparency value
Style
public Style(int fgColor, int bgColor, Font f, byte transparency, Image im, byte backgroundType)Parameters
fgColorint- foreground color
bgColorint- background color
fFont- font
transparencybyte- transparency value
imImage- background image
backgroundTypebyte- 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
public static Style createProxyStyle(Style... styles)Parameters
stylesStyle...- the styles to which we will proxy
Returns
markAsRendererStyle
public void markAsRendererStyle()isRendererStyle
public boolean isRendererStyle()Returns
true if #markAsRendererStyle() was invoked.merge
public void merge(Style style)Parameters
styleStyle- new values of styles from the current theme
getElevation
public int getElevation()Returns
setElevation
public void setElevation(int elevation)Parameters
elevationint- The elevation value.
getIconGap
public int getIconGap()getLetterSpacing
public float getLetterSpacing()setLetterSpacing
public void setLetterSpacing(float letterSpacing)setLetterSpacing
public void setLetterSpacing(float spacing, boolean override)setLetterSpacing(float).setIconGap
public void setIconGap(float gap)Parameters
gapfloat- The icon gap.
See also
getIconGapUnit
public int getIconGapUnit()#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
setIconGapUnit
public void setIconGapUnit(byte unit)Parameters
unitbyte- The icon gap unit. One of the standard style units of measurement.
isSurface
public boolean isSurface()Returns
setSurface
public void setSurface(boolean surface)Parameters
surfaceboolean- True to enable surface rendering mode.
isModified
public boolean isModified()Returns
getBgColor
public int getBgColor()Returns
setBgColor
public void setBgColor(int bgColor)Parameters
bgColorint- RRGGBB color that ignors the alpha component
getBgImage
public Image getBgImage()Returns
setBgImage
public void setBgImage(Image bgImage)Parameters
bgImageImage- background image
getBackgroundType
public byte getBackgroundType()Returns
setBackgroundType
public void setBackgroundType(byte backgroundType)Parameters
backgroundTypebyte- 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()Returns
setBackgroundGradientStartColor
public void setBackgroundGradientStartColor(int backgroundGradientStartColor)Parameters
backgroundGradientStartColorint- start color for the linear/radial gradient
getBackgroundGradientEndColor
public int getBackgroundGradientEndColor()Returns
setBackgroundGradientEndColor
public void setBackgroundGradientEndColor(int backgroundGradientEndColor)Parameters
backgroundGradientEndColorint- end color for the linear/radial gradient
getBackgroundGradientRelativeX
public float getBackgroundGradientRelativeX()Returns
setBackgroundGradientRelativeX
public void setBackgroundGradientRelativeX(float backgroundGradientRelativeX)Parameters
backgroundGradientRelativeXfloat- x position of the radial gradient center
getBackgroundGradientRelativeY
public float getBackgroundGradientRelativeY()Returns
setBackgroundGradientRelativeY
public void setBackgroundGradientRelativeY(float backgroundGradientRelativeY)Parameters
backgroundGradientRelativeYfloat- y position of the radial gradient center
getBackgroundGradientRelativeSize
public float getBackgroundGradientRelativeSize()Returns
setBackgroundGradientRelativeSize
public void setBackgroundGradientRelativeSize(float backgroundGradientRelativeSize)Parameters
backgroundGradientRelativeSizefloat- the size of the radial gradient
getFgColor
public int getFgColor()Returns
setFgColor
public final void setFgColor(int fgColor)Parameters
fgColorint- foreground color
getFgAlpha
public int getFgAlpha()Returns
setFgAlpha
public void setFgAlpha(int fgAlpha)Parameters
fgAlphaint- foreground alpha
getFont
public Font getFont()Returns
setFont
public void setFont(Font font)Parameters
fontFont- the font
setElevation
public void setElevation(int elevation, boolean override)Parameters
elevationint- The elevation value.
overrideboolean- If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
setIconGap
public void setIconGap(float gap, byte units, boolean override)Parameters
gapfloat- The gap.
unitsbyte- The units of the gap.
overrideboolean- 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
setIconGap
public void setIconGap(float gap, boolean override)Parameters
gapfloat- the icon gap.
overrideboolean- 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
setIconGap
public void setIconGap(float gap, byte unit)Parameters
gapfloat- The icon gap.
unitbyte- The unit. One of the standard style units of measurement.
setIconGapUnit
public void setIconGapUnit(byte unit, boolean override)Parameters
unitbyte- The icon gap unit. One of the standard style units of measurement.
overrideboolean- If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
setSurface
public void setSurface(boolean surface, boolean override)Parameters
surfaceboolean- True to enable surface rendering mode.
overrideboolean- If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
setAlignment
public void setAlignment(int align, boolean override)Parameters
alignint- alignment value
overrideboolean- If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
getAlignment
public int getAlignment()Returns
setAlignment
public void setAlignment(int align)Parameters
alignint- alignment value
isUnderline
public boolean isUnderline()Returns
setUnderline
public void setUnderline(boolean underline)Parameters
underlineboolean- true to turn underline on, false to turn it off
set3DText
public void set3DText(boolean t, boolean raised)Parameters
tboolean- true to turn 3d shadow effect on, false to turn it off
raisedboolean- indicates a raised or lowered effect
is3DTextNorth
public boolean is3DTextNorth()Returns
set3DTextNorth
public void set3DTextNorth(boolean north)Parameters
northboolean- true to enable 3d text with the shadow on top false otherwise
isRaised3DText
public boolean isRaised3DText()Returns
isLowered3DText
public boolean isLowered3DText()Returns
isOverline
public boolean isOverline()Returns
setOverline
public void setOverline(boolean overline)Parameters
overlineboolean- true to turn overline on, false to turn it off
isStrikeThru
public boolean isStrikeThru()Returns
setStrikeThru
public void setStrikeThru(boolean strikethru)Parameters
strikethruboolean- true to turn strike through on, false to turn it off
getTextDecoration
public int getTextDecoration()Returns
setTextDecoration
public void setTextDecoration(int textDecoration)Parameters
textDecorationint- the textDecoration to set (bitmask of the TEXT_DECORATION_* constants)
setTextDecoration
public void setTextDecoration(int textDecoration, boolean override)Parameters
textDecorationint- the textDecoration to set (bitmask of the TEXT_DECORATION_* constants)
overrideboolean- 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
setBgTransparency
public void setBgTransparency(byte transparency)Parameters
transparencybyte- transparency level as byte
setBgTransparency
public void setBgTransparency(int transparency)Parameters
transparencyint- int value between 0-255
getOpacity
public int getOpacity()Returns
setOpacity
public final void setOpacity(int opacity)Parameters
opacityint- the opacity value
setOpacity
public final void setOpacity(int opacity, boolean override)Parameters
opacityint- int value between 0-255
overrideboolean- 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()setPadding
public void setPadding(int top, int bottom, int left, int right)#setPaddingUnit(byte...)Parameters
topint- number of units to pad the top
bottomint- number of units to pad the bottom
leftint- number of units to pad the left
rightint- number of units to pad the right
See also
setPadding
public void setPadding(float top, float bottom, float left, float right)#setPaddingUnit(byte...)Parameters
topfloat- number of units to pad the top
bottomfloat- number of units to pad the bottom
leftfloat- number of units to pad the left
rightfloat- number of units to pad the right
See also
setPadding
public void setPadding(int orientation, int gap)#setPaddingUnit(byte...)Parameters
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
gapint- number of units to pad the orientation
setPadding
public void setPadding(int orientation, float gap)#setPaddingUnit(byte...)Parameters
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
gapfloat- number of units to pad the orientation
setMargin
public void setMargin(int top, int bottom, int left, int right)Parameters
topint- number of margin using the current unit
bottomint- number of margin using the current unit
leftint- number of margin using the current unit
rightint- number of margin using the current unit
setMargin
public void setMargin(float top, float bottom, float left, float right)Parameters
topfloat- number of margin using the current unit
bottomfloat- number of margin using the current unit
leftfloat- number of margin using the current unit
rightfloat- number of margin using the current unit
cacheMargins
public void cacheMargins(boolean override)Parameters
overrideboolean- if true, margins are cached even if a previous cache already exists. If false, margins are cached only if no cache already exists. Warning: This method is used internally when hidding a component with the Component.setHidden(true) method and expect a component with no previous margins cache. So do not use this method on a component that would be hidden or flush its margins cache by calling flushMarginsCache() before hidding the component. And do not use on an hidden component either or unhidding this component might result in unexpected results
restoreCachedMargins
public void restoreCachedMargins()flushMarginsCache
public void flushMarginsCache()setMargin
public void setMargin(int orientation, int gap)Parameters
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
gapint- number of margin using the current unit
setMargin
public void setMargin(int orientation, float gap)Parameters
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
gapfloat- number of margin using the current unit
getPaddingValue
public int getPaddingValue(boolean rtl, int orientation)int)Parameters
rtlboolean- flag indicating whether the padding is for an RTL bidi component
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
See also
getPaddingFloatValue
public float getPaddingFloatValue(boolean rtl, int orientation)Parameters
rtlboolean- flag indicating whether the padding is for an RTL bidi component
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
See also
getPaddingLeft
public int getPaddingLeft(boolean rtl)Parameters
rtlboolean- indicates a right to left language
Returns
setPaddingUnitLeft
public void setPaddingUnitLeft(byte unit)Parameters
unitbyte- 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.
setPaddingUnitRight
public void setPaddingUnitRight(byte unit)Parameters
unitbyte- 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.
setPaddingUnitTop
public void setPaddingUnitTop(byte unit)Parameters
unitbyte- 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.
setPaddingUnitBottom
public void setPaddingUnitBottom(byte unit)Parameters
unitbyte- 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.
getPaddingRight
public int getPaddingRight(boolean rtl)Parameters
rtlboolean- indicates a right to left language
Returns
getPaddingTop
public int getPaddingTop()Returns
setPaddingTop
public void setPaddingTop(int gap)setPadding(Component.TOP, gap, false);Parameters
gapint- amount to pad the top in current units.
See also
setPaddingTop
public void setPaddingTop(float gap)setPadding(Component.TOP, gap, false);Parameters
gapfloat- Amount to pad the top in current units.
setPaddingLeft
public void setPaddingLeft(int gap)setPadding(Component.LEFT, gap, false);Parameters
gapint- Amount to pad the left in current units.
setPaddingLeft
public void setPaddingLeft(float gap)setPadding(Component.LEFT, gap, false);Parameters
gapfloat- Amount to pad the left in current units.
setPaddingRight
public void setPaddingRight(int gap)setPadding(Component.RIGHT, gap, false);Parameters
gapint- Amount to pad the right in current units.
setPaddingRight
public void setPaddingRight(float gap)setPadding(Component.RIGHT, gap, false);Parameters
gapfloat- Amount to pad the right in current units.
setMarginLeft
public void setMarginLeft(int gap)setMargin(Component.LEFT, gap, false);Parameters
gapint- number of left margin using the current unit
setMarginLeft
public void setMarginLeft(float gap)setMargin(Component.LEFT, gap, false);Parameters
gapfloat- number of left margin using the current unit
setMarginRight
public void setMarginRight(int gap)setMargin(Component.RIGHT, gap, false);Parameters
gapint- number of right margin using the current unit
setMarginRight
public void setMarginRight(float gap)setMargin(Component.RIGHT, gap, false);Parameters
gapfloat- number of right margin using the current unit
getPaddingBottom
public int getPaddingBottom()Returns
setPaddingBottom
public void setPaddingBottom(int gap)setPadding(Component.BOTTOM, gap, false);Parameters
gapint- Amount to pad the bottom in current units.
setPaddingBottom
public void setPaddingBottom(float gap)setPadding(Component.BOTTOM, gap, false);Parameters
gapfloat- Amount to pad the bottom in current units.
getHorizontalMargins
public int getHorizontalMargins()Returns
getVerticalMargins
public int getVerticalMargins()Returns
getHorizontalPadding
public int getHorizontalPadding()Returns
getVerticalPadding
public int getVerticalPadding()Returns
getMarginRightNoRTL
public int getMarginRightNoRTL()Returns
getMarginLeftNoRTL
public int getMarginLeftNoRTL()Returns
getPaddingRightNoRTL
public int getPaddingRightNoRTL()Returns
getPaddingLeftNoRTL
public int getPaddingLeftNoRTL()Returns
getMarginRight
public int getMarginRight(boolean rtl)Parameters
rtlboolean- indicates a right to left language
Returns
getMarginLeft
public int getMarginLeft(boolean rtl)Parameters
rtlboolean- indicates a right to left language
Returns
getMarginTop
public int getMarginTop()Returns
setMarginTop
public void setMarginTop(int gap)setMargin(Component.TOP, gap, false);Parameters
gapint- number of top margin using the current unit
setMarginTop
public void setMarginTop(float gap)setMargin(Component.TOP, gap, false);Parameters
gapfloat- number of top margin using the current unit
getMarginBottom
public int getMarginBottom()Returns
setMarginBottom
public void setMarginBottom(int gap)setMargin(Component.BOTTOM, gap, false);Parameters
gapint- number of bottom margin using the current unit
setMarginBottom
public void setMarginBottom(float gap)setMargin(Component.BOTTOM, gap, false);Parameters
gapfloat- number of bottom margin using the current unit
getPadding
public int getPadding(boolean rtl, int orientation)Parameters
rtlboolean- flag indicating whether the padding is for an RTL bidi component
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
getPadding
public int getPadding(int orientation)Parameters
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
getMargin
public int getMargin(int orientation)Parameters
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
getMargin
public int getMargin(boolean rtl, int orientation)Parameters
rtlboolean- flag indicating whether the padding is for an RTL bidi component
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
getMarginValue
public int getMarginValue(boolean rtl, int orientation)int)Parameters
rtlboolean- flag indicating whether the padding is for an RTL bidi component
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
getMarginFloatValue
public float getMarginFloatValue(boolean rtl, int orientation)Parameters
rtlboolean- flag indicating whether the padding is for an RTL bidi component
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
Returns
setBgColor
public void setBgColor(int bgColor, boolean override)Parameters
bgColorint- RRGGBB color that ignores the alpha component
overrideboolean- 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
public void setBgImage(Image bgImage, boolean override)Parameters
bgImageImage- background image
overrideboolean- 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)Parameters
backgroundTypebyte- 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
overrideboolean- 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)Parameters
backgroundGradientStartColorint- start color for the linear/radial gradient
overrideboolean- 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)Parameters
backgroundGradientEndColorint- end color for the linear/radial gradient
overrideboolean- 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)Parameters
backgroundGradientRelativeXfloat- x position of the radial gradient center
overrideboolean- 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)Parameters
backgroundGradientRelativeYfloat- y position of the radial gradient center
overrideboolean- 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)Parameters
backgroundGradientRelativeSizefloat- the size of the radial gradient relative to the screens larger dimension
overrideboolean- If set to true allows the look and feel/theme to override the value in this attribute when changing a theme/look and feel
getGradient
public Gradient getGradient()BACKGROUND_GRADIENT_LINEAR / BACKGROUND_GRADIENT_RADIAL_FULL /
BACKGROUND_GRADIENT_CONIC / BACKGROUND_GRADIENT_REPEATING_*. May
be null if this Style uses no extended gradient.setGradient
public void setGradient(Gradient gradient)setGradient
public void setGradient(Gradient gradient, boolean override)getFilterBlurRadius
public float getFilterBlurRadius()setFilterBlurRadius
public void setFilterBlurRadius(float radius)setFilterBlurRadius
public void setFilterBlurRadius(float radius, boolean override)getBackdropFilterBlurRadius
public float getBackdropFilterBlurRadius()setBackdropFilterBlurRadius
public void setBackdropFilterBlurRadius(float radius)setBackdropFilterBlurRadius
public void setBackdropFilterBlurRadius(float radius, boolean override)getFilterColorMatrix
public float[] getFilterColorMatrix()brightness / contrast / grayscale / hue-rotate / invert /
opacity / saturate / sepia. Returns null when no color filter
is active (treat as identity).setFilterColorMatrix
public void setFilterColorMatrix(float[] matrix)setFilterColorMatrix
public void setFilterColorMatrix(float[] matrix, boolean override)getBackdropFilterColorMatrix
public float[] getBackdropFilterColorMatrix()filterColorMatrix
but applied to whatever is painted behind the component.setBackdropFilterColorMatrix
public void setBackdropFilterColorMatrix(float[] matrix)setBackdropFilterColorMatrix
public void setBackdropFilterColorMatrix(float[] matrix, boolean override)isExtendedGradientBackground
public boolean isExtendedGradientBackground()setFgColor
public final void setFgColor(int fgColor, boolean override)Parameters
fgColorint- foreground color
overrideboolean- 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)Parameters
fgAlphaint- foreground alpha
overrideboolean- 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
public void setFont(Font font, boolean override)Parameters
fontFont- the font
overrideboolean- 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)Parameters
transparencyint- int value between 0-255
overrideboolean- 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)Parameters
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
gapint- number of pixels to pad the orientation
overrideboolean- 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)Parameters
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
gapfloat- number of pixels to pad the orientation
overrideboolean- 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)Parameters
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
gapint- number of margin using the current unit
overrideboolean- 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)Parameters
orientationint- one of: Component.TOP, Component.BOTTOM, Component.LEFT, Component.RIGHT
gapfloat- number of margin using the current unit
overrideboolean- 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()Returns
setSuppressChangeEvents
public void setSuppressChangeEvents(boolean suppress)Parameters
suppressboolean- True to suppress change events.
addStyleListener
public void addStyleListener(StyleListener l)Parameters
lStyleListener- a style listener
removeStyleListener
public void removeStyleListener(StyleListener l)Parameters
lStyleListener- a style listener
removeListeners
public void removeListeners()setBorder
public void setBorder(Border border, boolean override)Parameters
borderBorder- new border object for the component
overrideboolean- 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
public Border getBorder()Returns
setBorder
public void setBorder(Border border)Parameters
borderBorder- new border object for the component
getBgPainter
public Painter getBgPainter()Returns
setBgPainter
public void setBgPainter(Painter bgPainter)Parameters
bgPainterPainter- 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
setPaddingUnit
public void setPaddingUnit(byte... paddingUnit)#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
paddingUnitbyte...- 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
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
marginUnitbyte...- the marginUnit to set
setMarginUnitLeft
public void setMarginUnitLeft(byte unit)Parameters
unitbyte- 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.
setMarginUnitRight
public void setMarginUnitRight(byte unit)Parameters
unitbyte- 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.
setMarginUnitTop
public void setMarginUnitTop(byte unit)Parameters
unitbyte- 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.
setMarginUnitBottom
public void setMarginUnitBottom(byte unit)Parameters
unitbyte- 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.
equals
public boolean equals(Object obj)hashCode
public int hashCode()