public class StyleRange extends TextStyle implements java.lang.Cloneable
StyleRange
defines a set of styles for a specified range of
text.
The hashCode() method in this class uses the values of the public fields to compute the hash value. When storing instances of the class in hashed collections, do not modify these fields after the object has been inserted.
Modifier and Type | Field and Description |
---|---|
static int |
BOLD
The font style constant indicating a bold weight font (value is
1<<0).
|
int |
fontStyle
the font style of the range.
|
static int |
ITALIC
The font style constant indicating an italic font (value is 1<<1).
|
int |
length
the length of the range
|
static int |
NORMAL
The font style constant indicating a normal weight, non-italic font
(value is 0).
|
int |
start
the start offset of the range, zero-based from the document start
|
background, BORDER_DASH, BORDER_DOT, BORDER_SOLID, borderColor, borderStyle, data, font, foreground, hoverStylename, NONE, rise, strikeout, strikeoutColor, stylename, underline, UNDERLINE_DOUBLE, UNDERLINE_ERROR, UNDERLINE_LINK, UNDERLINE_SINGLE, UNDERLINE_SQUIGGLE, underlineColor, underlineStyle
Constructor and Description |
---|
StyleRange(java.lang.String stylename)
Create a new style range with no styles
|
StyleRange(java.lang.String stylename,
int start,
int length,
javafx.scene.paint.Color foreground,
javafx.scene.paint.Color background)
Create a new style range.
|
StyleRange(java.lang.String stylename,
int start,
int length,
javafx.scene.paint.Color foreground,
javafx.scene.paint.Color background,
int fontStyle)
Create a new style range.
|
StyleRange(TextStyle style)
Create a new style range from an existing text style.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a new StyleRange with the same values as this StyleRange.
|
boolean |
equals(java.lang.Object object)
Compares the argument to the receiver, and returns true if they represent
the same object using a class specific comparison.
|
int |
hashCode()
Returns an integer hash code for the receiver.
|
boolean |
isUnstyled()
Returns whether or not the receiver is unstyled (i.e., does not have any
style attributes specified).
|
boolean |
similarTo(StyleRange style)
Compares the specified object to this StyleRange and answer if the two
are similar.
|
java.lang.String |
toString()
Returns a string containing a concise, human-readable description of the
receiver.
|
public static final int NORMAL
ProgressBar
to
indicate a normal state.
Used By:
ProgressBar
public static final int BOLD
public static final int ITALIC
public int start
public int length
public int fontStyle
font
attribute is
setpublic StyleRange(java.lang.String stylename)
stylename
- the css stylenamepublic StyleRange(TextStyle style)
style
- the text style to copypublic StyleRange(java.lang.String stylename, int start, int length, javafx.scene.paint.Color foreground, javafx.scene.paint.Color background)
stylename
- the css stylenamestart
- start offset of the stylelength
- length of the styleforeground
- foreground color of the style, null if nonebackground
- background color of the style, null if nonepublic StyleRange(java.lang.String stylename, int start, int length, javafx.scene.paint.Color foreground, javafx.scene.paint.Color background, int fontStyle)
stylename
- the css stylenamestart
- start offset of the stylelength
- length of the styleforeground
- foreground color of the style, null if nonebackground
- background color of the style, null if nonefontStyle
- font style of the style, may be SWT.NORMAL, SWT.ITALIC or
SWT.BOLDpublic boolean equals(java.lang.Object object)
equals
in class TextStyle
object
- the object to compare with this objecttrue
if the object is the same as this object and
false
otherwisehashCode()
public int hashCode()
true
when passed to equals
must return
the same value for this method.hashCode
in class TextStyle
equals(Object)
public boolean isUnstyled()
public boolean similarTo(StyleRange style)
style
- the object to compare with this objectpublic java.lang.Object clone()
clone
in class java.lang.Object