com.alee.extended.label
Class StyleRange

java.lang.Object
  extended by com.alee.extended.label.StyleRange

public class StyleRange
extends java.lang.Object

This class represents custom text style for WebStyledLabel component. It contains various style settings supported by the styled label UI.

Author:
Mikle Garin
See Also:
WebStyledLabel

Field Summary
protected  java.awt.Color background
          Text background.
protected  java.util.List<CustomStyle> customStyles
          Custom text styles.
protected  java.awt.Color foreground
          Text foreground.
protected  int length
          Text style length.
protected  int startIndex
          Text style start index.
protected  int style
          Basic text style.
 
Constructor Summary
StyleRange(int startIndex, int length, java.awt.Color foreground, java.awt.Color background, CustomStyle... customStyles)
          Constructs new StyleRange with the specified settings
StyleRange(int startIndex, int length, java.awt.Color foreground, CustomStyle... customStyles)
          Constructs new StyleRange with the specified settings
StyleRange(int startIndex, int length, CustomStyle... customStyles)
          Constructs new empty StyleRange.
StyleRange(int startIndex, int length, int style, java.awt.Color foreground, java.awt.Color background, CustomStyle... customStyles)
          Constructs new StyleRange with the specified settings
StyleRange(int startIndex, int length, int style, java.awt.Color foreground, CustomStyle... customStyles)
          Constructs new StyleRange with the specified settings
StyleRange(int startIndex, int length, int style, CustomStyle... customStyles)
          Constructs new StyleRange with the specified settings
StyleRange(StyleRange styleRange)
          Constructs new StyleRange based on another StyleRange settings.
 
Method Summary
 java.awt.Color getBackground()
          Returns background color.
 java.util.List<CustomStyle> getCustomStyle()
          Returns custom styles applied to the text.
protected static CustomStyle[] getCustomStyles(StyleRange styleRange)
          Returns custom styles array.
 java.awt.Color getForeground()
          Returns foreground color.
 int getLength()
          Returns text style length.
 int getStartIndex()
          Returns text style start index.
 int getStyle()
          Returns basic text style.
 boolean isDoubleStrikeThrough()
          Returns whether the text is double strike through or not.
 boolean isStrikeThrough()
          Returns whether the text is strike through or not.
 boolean isSubscript()
          Returns whether the text is subscript or not.
 boolean isSuperscript()
          Returns whether the text is superscript or not.
 boolean isUnderlined()
          Returns whether the text is underlined or not.
 boolean isWaved()
          Returns whether the line is waved or not.
 void setLength(int length)
          Sets text style length.
 void setStartIndex(int startIndex)
          Sets text style start index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

startIndex

protected int startIndex
Text style start index.


length

protected int length
Text style length.


foreground

protected java.awt.Color foreground
Text foreground.


background

protected java.awt.Color background
Text background.


style

protected int style
Basic text style. Either Font.ITALIC or Font.BOLD or their combination.


customStyles

protected java.util.List<CustomStyle> customStyles
Custom text styles.

See Also:
CustomStyle
Constructor Detail

StyleRange

public StyleRange(StyleRange styleRange)
Constructs new StyleRange based on another StyleRange settings.

Parameters:
styleRange - style range

StyleRange

public StyleRange(int startIndex,
                  int length,
                  CustomStyle... customStyles)
Constructs new empty StyleRange.

Parameters:
startIndex - text style start index
length - text style length
customStyles - custom text styles

StyleRange

public StyleRange(int startIndex,
                  int length,
                  int style,
                  CustomStyle... customStyles)
Constructs new StyleRange with the specified settings

Parameters:
startIndex - text style start index
length - text style length
style - basic text style
customStyles - custom text styles

StyleRange

public StyleRange(int startIndex,
                  int length,
                  java.awt.Color foreground,
                  CustomStyle... customStyles)
Constructs new StyleRange with the specified settings

Parameters:
startIndex - text style start index
length - text style length
foreground - text foreground color
customStyles - custom text styles

StyleRange

public StyleRange(int startIndex,
                  int length,
                  java.awt.Color foreground,
                  java.awt.Color background,
                  CustomStyle... customStyles)
Constructs new StyleRange with the specified settings

Parameters:
startIndex - text style start index
length - text style length
foreground - text foreground color
background - text background color
customStyles - custom text styles

StyleRange

public StyleRange(int startIndex,
                  int length,
                  int style,
                  java.awt.Color foreground,
                  CustomStyle... customStyles)
Constructs new StyleRange with the specified settings

Parameters:
startIndex - text style start index
length - text style length
style - basic text style
foreground - text foreground color
customStyles - custom text styles

StyleRange

public StyleRange(int startIndex,
                  int length,
                  int style,
                  java.awt.Color foreground,
                  java.awt.Color background,
                  CustomStyle... customStyles)
Constructs new StyleRange with the specified settings

Parameters:
startIndex - text style start index
length - text style length
style - basic text style
foreground - text foreground color
background - text background color
customStyles - custom text styles
Method Detail

getStartIndex

public int getStartIndex()
Returns text style start index.

Returns:
text style start index

setStartIndex

public void setStartIndex(int startIndex)
Sets text style start index.

Parameters:
startIndex - new text style start index

getLength

public int getLength()
Returns text style length.

Returns:
text style length

setLength

public void setLength(int length)
Sets text style length.

Parameters:
length - new text style length

getStyle

public int getStyle()
Returns basic text style.

Returns:
basic text style

getForeground

public java.awt.Color getForeground()
Returns foreground color.

Returns:
foreground color.

getBackground

public java.awt.Color getBackground()
Returns background color.

Returns:
background color.

isStrikeThrough

public boolean isStrikeThrough()
Returns whether the text is strike through or not.

Returns:
true if the text is strike through, false otherwise

isDoubleStrikeThrough

public boolean isDoubleStrikeThrough()
Returns whether the text is double strike through or not.

Returns:
true if the text is double strike through, false otherwise

isWaved

public boolean isWaved()
Returns whether the line is waved or not.

Returns:
true if the line is waved, false otherwise

isUnderlined

public boolean isUnderlined()
Returns whether the text is underlined or not.

Returns:
true if the text is underlined, false otherwise

isSuperscript

public boolean isSuperscript()
Returns whether the text is superscript or not.

Returns:
true if the text is superscript, false otherwise

isSubscript

public boolean isSubscript()
Returns whether the text is subscript or not.

Returns:
true if the text is subscript, false otherwise

getCustomStyle

public java.util.List<CustomStyle> getCustomStyle()
Returns custom styles applied to the text.

Returns:
custom styles applied to the text

getCustomStyles

protected static CustomStyle[] getCustomStyles(StyleRange styleRange)
Returns custom styles array.

Parameters:
styleRange - style range
Returns:
custom styles array