|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.swing.StyleRange
public class StyleRange
A data structure represents a style for a range of text. There are two categories of styles that currently supports. One is the font style and color which includes bold, italic, superscript, subscript as well as the color of the text. The other one is line color and style. The line style could be straight line, dotted line, waved line or any customized style using Stroke. The line could be used as underline or strikethrough line.
The name of StyleRange comes from SWT's StyleRange. We borrowed some design idea from it. StyledLabel is actually very similar to SWT's StyledText. Saying that, the features of the two components are not exactly the same since the purpose of the two components are quite different.
Field Summary | |
---|---|
static int |
STYLE_DOTTED
|
static int |
STYLE_DOUBLE_STRIKE_THROUGH
|
static int |
STYLE_STRIKE_THROUGH
|
static int |
STYLE_SUBSCRIPT
|
static int |
STYLE_SUPERSCRIPT
|
static int |
STYLE_UNDERLINED
|
static int |
STYLE_WAVED
|
Constructor Summary | |
---|---|
StyleRange(Color fontColor)
Creates a style range with a specified font color. |
|
StyleRange(int fontStyle)
Creates a style range with a specified font style. |
|
StyleRange(int fontStyle,
Color fontColor)
Creates a style range with a specified font style and font color. |
|
StyleRange(int fontStyle,
Color fontColor,
Color backgroundColor,
int additionalStyle,
Color lineColor)
Creates a style range with a specified font style, font color, and additional style. |
|
StyleRange(int fontStyle,
Color fontColor,
int additionalStyle,
Color lineColor)
Creates a style range with a specified font style, font color, and additional style. |
|
StyleRange(int fontStyle,
Color fontColor,
int additionalStyle,
Color lineColor,
Stroke lineStroke)
Creates a style range with a specified font style, font color, additional style, and line color. |
|
StyleRange(int fontStyle,
int additionalStyle)
Creates a style range with a specified font style and additional style. |
|
StyleRange(int start,
int length,
Color fontColor)
Creates a style range with a specified font color and a range. |
|
StyleRange(int fontStyle,
int additionalStyle,
float fontShrinkRatio)
Creates a style range with a specified font style and additional style. |
|
StyleRange(int start,
int length,
int fontStyle)
Creates a style range with a specified font style and a range. |
|
StyleRange(int start,
int length,
int fontStyle,
Color fontColor)
Creates a style range with a specified font style, font color and a range. |
|
StyleRange(int start,
int length,
int fontStyle,
Color fontColor,
Color backgroundColor,
int additionalStyle)
Creates a style range with a specified font style, font color, additional style and a range. |
|
StyleRange(int start,
int length,
int fontStyle,
Color fontColor,
Color backgroundColor,
int additionalStyle,
Color lineColor)
Creates a style range with a specified font style, font color, additional style, line color and a range. |
|
StyleRange(int start,
int length,
int fontStyle,
Color fontColor,
Color backgroundColor,
int additionalStyle,
Color lineColor,
Stroke lineStroke)
Creates a style range with a specified font style, font color, additional style, line color, line stroke and a range. |
|
StyleRange(int start,
int length,
int fontStyle,
Color fontColor,
Color backgroundColor,
int additionalStyle,
Color lineColor,
Stroke lineStroke,
float fontShrinkRatio)
Creates a style range with a specified font style, font color, additional style, line color, line stroke and a range. |
|
StyleRange(int start,
int length,
int fontStyle,
Color fontColor,
int additionalStyle)
Creates a style range with a specified font style, font color, additional style and a range. |
|
StyleRange(int start,
int length,
int fontStyle,
Color fontColor,
int additionalStyle,
Color lineColor)
Creates a style range with a specified font style, font color, additional style, line color and a range. |
|
StyleRange(int start,
int length,
int fontStyle,
Color fontColor,
int additionalStyle,
Color lineColor,
Stroke lineStroke)
Creates a style range with a specified font style, font color, additional style, line color, line stroke and a range. |
|
StyleRange(int start,
int length,
int fontStyle,
Color fontColor,
int additionalStyle,
Color lineColor,
Stroke lineStroke,
float fontShrinkRatio)
Creates a style range with a specified font style, font color, additional style, line color, line stroke and a range. |
|
StyleRange(int start,
int length,
int fontStyle,
int additionalStyle)
Creates a style range with a specified font style, additional style and a range. |
|
StyleRange(int start,
int length,
int fontStyle,
int additionalStyle,
float fontShrinkRatio)
Creates a style range with a specified font style, additional style and a range. |
|
StyleRange(StyleRange range)
Creates a style range exactly the same with the existing range. |
Method Summary | |
---|---|
int |
getAdditionalStyle()
Gets the additional style. |
Color |
getBackgroundColor()
Gets the background color. |
Color |
getFontColor()
Gets the font color. |
float |
getFontShrinkRatio()
Gets the font shrink ratio for superscript and subscript. |
int |
getFontStyle()
Gets the font style. |
int |
getLength()
Gets the length of the range. |
Color |
getLineColor()
Gets the line color. |
Stroke |
getLineStroke()
Gets the line stroke. |
int |
getStart()
Gets the start index of the range. |
boolean |
isDotted()
Checks if the line has dotted style. |
boolean |
isDoublestrikethrough()
Checks if the text has double strike through style. |
boolean |
isStrikethrough()
Checks if the text has strike through style. |
boolean |
isSubscript()
Checks if the text is subscript. |
boolean |
isSuperscript()
Checks if the text is superscript. |
boolean |
isUnderlined()
Checks if the text has underlined style. |
boolean |
isWaved()
Checks if the line has waved style. |
void |
setLength(int length)
Sets the length of the range. |
void |
setStart(int start)
Sets the start index of the range. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int STYLE_STRIKE_THROUGH
public static final int STYLE_DOUBLE_STRIKE_THROUGH
public static final int STYLE_WAVED
public static final int STYLE_UNDERLINED
public static final int STYLE_DOTTED
public static final int STYLE_SUPERSCRIPT
public static final int STYLE_SUBSCRIPT
Constructor Detail |
---|
public StyleRange(int fontStyle)
fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.public StyleRange(Color fontColor)
fontColor
- the color of the textpublic StyleRange(int fontStyle, Color fontColor)
fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.fontColor
- the color of the textpublic StyleRange(int fontStyle, int additionalStyle)
fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to connect two or more styles as long as it makes
sense.public StyleRange(int fontStyle, int additionalStyle, float fontShrinkRatio)
fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to concat two or more styles as long as it makes
sense.fontShrinkRatio
- the ratio that regular font size divides by subscript or superscript font size.public StyleRange(int start, int length, int fontStyle)
start
- the start index of the range in a stringlength
- the length of the range.fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.public StyleRange(int start, int length, int fontStyle, Color fontColor)
start
- the start index of the range in a stringlength
- the length of the range.fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.fontColor
- the color of the text.public StyleRange(int start, int length, Color fontColor)
start
- the start index of the range in a stringlength
- the length of the range.fontColor
- the color of the text.public StyleRange(int start, int length, int fontStyle, int additionalStyle)
start
- the start index of the range in a stringlength
- the length of the range.fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to concat two or more styles as long as it makes
sense.public StyleRange(int start, int length, int fontStyle, int additionalStyle, float fontShrinkRatio)
start
- the start index of the range in a stringlength
- the length of the range.fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to concat two or more styles as long as it makes
sense.fontShrinkRatio
- the ratio that regular font size divides by subscript or superscript font size.public StyleRange(int fontStyle, Color fontColor, int additionalStyle, Color lineColor)
fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.fontColor
- the color of the text.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to concat two or more styles as long as it makes
sense.public StyleRange(int fontStyle, Color fontColor, Color backgroundColor, int additionalStyle, Color lineColor)
fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.fontColor
- the color of the text.backgroundColor
- the background color of the text.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to concat two or more styles as long as it makes
sense.public StyleRange(int start, int length, int fontStyle, Color fontColor, int additionalStyle)
start
- the start index of the range in a stringlength
- the length of the range.fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.fontColor
- the color of the text.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to concat two or more styles as long as it makes
sense.public StyleRange(int start, int length, int fontStyle, Color fontColor, Color backgroundColor, int additionalStyle)
start
- the start index of the range in a stringlength
- the length of the range.fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.fontColor
- the color of the text.backgroundColor
- the background color of the text.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to concat two or more styles as long as it makes
sense.public StyleRange(int fontStyle, Color fontColor, int additionalStyle, Color lineColor, Stroke lineStroke)
fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.fontColor
- the color of the text.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to concat two or more styles as long as it makes
sense.lineColor
- the color of the line.public StyleRange(int start, int length, int fontStyle, Color fontColor, int additionalStyle, Color lineColor)
start
- the start index of the range in a stringlength
- the length of the range.fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.fontColor
- the color of the text.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to concat two or more styles as long as it makes
sense.lineColor
- the color of the line.public StyleRange(int start, int length, int fontStyle, Color fontColor, Color backgroundColor, int additionalStyle, Color lineColor)
start
- the start index of the range in a stringlength
- the length of the range.fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.fontColor
- the color of the text.backgroundColor
- the background color of the text.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to concat two or more styles as long as it makes
sense.lineColor
- the color of the line.public StyleRange(int start, int length, int fontStyle, Color fontColor, int additionalStyle, Color lineColor, Stroke lineStroke)
start
- the start index of the range in a stringlength
- the length of the range.fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.fontColor
- the color of the text.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to concat two or more styles as long as it makes
sense.lineColor
- the color of the line.lineStroke
- the stroke of the line.public StyleRange(int start, int length, int fontStyle, Color fontColor, Color backgroundColor, int additionalStyle, Color lineColor, Stroke lineStroke)
start
- the start index of the range in a stringlength
- the length of the range.fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.fontColor
- the color of the text.backgroundColor
- the background color of the text.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to concat two or more styles as long as it makes
sense.lineColor
- the color of the line.lineStroke
- the stroke of the line.public StyleRange(int start, int length, int fontStyle, Color fontColor, int additionalStyle, Color lineColor, Stroke lineStroke, float fontShrinkRatio)
start
- the start index of the range in a stringlength
- the length of the range.fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.fontColor
- the color of the text.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use any | to concat two or more styles as long as it makes
sense.lineColor
- the color of the line.lineStroke
- the stroke of the line.fontShrinkRatio
- the ratio that regular font size divides by subscript or superscript font size.public StyleRange(StyleRange range)
range
- the old rangepublic StyleRange(int start, int length, int fontStyle, Color fontColor, Color backgroundColor, int additionalStyle, Color lineColor, Stroke lineStroke, float fontShrinkRatio)
start
- the start index of the range in a stringlength
- the length of the range.fontStyle
- Valid values are Font.PLAIN, Font.ITALIC, Font.BOLD or Font.BOLD | Font.ITALIC.fontColor
- the color of the text.backgroundColor
- the background color of the text.additionalStyle
- Valid additional styles are defined as constants in StyleRange
. The names begin
with STYLE_. You can also use bitwise OR "|" to concat any two or more styles as long as
it makes sense.lineColor
- the color of the line.lineStroke
- the stroke of the line.fontShrinkRatio
- the ratio that regular font size divides by subscript or superscript font size.Method Detail |
---|
public int getStart()
public void setStart(int start)
start
- the start index of the rangepublic int getLength()
public void setLength(int length)
length
- the length of the rangepublic int getFontStyle()
public Color getFontColor()
public Color getBackgroundColor()
public int getAdditionalStyle()
StyleRange
. The names
begin with STYLE_. The value could also be two or more styles concatenated by | as long as it makes sense. It
could be more convenient to use methods isStrikethrough()
, isDoublestrikethrough()
, isDotted()
, isWaved()
, isUnderlined()
, isSubscript()
, isSuperscript()
to
see what's the additional style.
public Color getLineColor()
public Stroke getLineStroke()
public boolean isStrikethrough()
public boolean isDoublestrikethrough()
public boolean isWaved()
public boolean isUnderlined()
public boolean isDotted()
public boolean isSuperscript()
public boolean isSubscript()
public float getFontShrinkRatio()
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |