public class TextStyle
extends java.lang.Object
TextStyle
defines a set of styles that can be applied to a 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.
Application code does not need to explicitly release the resources
managed by each instance when those instances are no longer required, and
thus no dispose()
method is provided.
Font
,
Color
,
TextLayout,
TextStyle snippets,
Sample code and further
informationModifier and Type | Field and Description |
---|---|
javafx.scene.paint.Color |
background
the background of the style
|
static int |
BORDER_DASH
Style constant to indicate dashed border (value is 2).
|
static int |
BORDER_DOT
Style constant to indicate dotted border (value is 4).
|
static int |
BORDER_SOLID
Style constant to indicate solid border (value is 1).
|
javafx.scene.paint.Color |
borderColor
the border color of the style
|
int |
borderStyle
the border style.
|
java.lang.Object |
data
the data.
|
javafx.scene.text.Font |
font
the font of the style
|
javafx.scene.paint.Color |
foreground
the foreground of the style
|
java.lang.String |
hoverStylename
The style named to used for hovering
|
static int |
NONE
No styling
|
int |
rise
the baseline rise of the style.
|
boolean |
strikeout
the strikeout flag of the style
|
javafx.scene.paint.Color |
strikeoutColor
the strikeout color of the style
|
java.lang.String |
stylename
The css stylename to use
|
boolean |
underline
the underline flag of the style.
|
static int |
UNDERLINE_DOUBLE
Style constant to indicate double underline (value is 1).
|
static int |
UNDERLINE_ERROR
Style constant to indicate error underline (value is 2).
|
static int |
UNDERLINE_LINK
Style constant to indicate link underline (value is 0).
|
static int |
UNDERLINE_SINGLE
Style constant to indicate single underline (value is 0).
|
static int |
UNDERLINE_SQUIGGLE
Style constant to indicate squiggle underline (value is 3).
|
javafx.scene.paint.Color |
underlineColor
the underline color of the style
|
int |
underlineStyle
the underline style.
|
Constructor and Description |
---|
TextStyle(java.lang.String stylename)
Create an empty text style.
|
TextStyle(java.lang.String stylename,
javafx.scene.text.Font font,
javafx.scene.paint.Color foreground,
javafx.scene.paint.Color background)
Create a new text style with the specified font, foreground and
background.
|
TextStyle(TextStyle style)
Create a new text style from an existing text style.
|
Modifier and Type | Method and Description |
---|---|
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.
|
java.lang.String |
toString()
Returns a string containing a concise, human-readable description of the
receiver.
|
public static final int NONE
public static final int UNDERLINE_SINGLE
Used By:
TextStyle
public static final int UNDERLINE_DOUBLE
Used By:
TextStyle
public static final int UNDERLINE_ERROR
Used By:
TextStyle
public static final int UNDERLINE_SQUIGGLE
Used By:
TextStyle
public static final int UNDERLINE_LINK
If the text color or the underline color are not set in the range the
usage of UNDERLINE_LINK
will change these colors to the
preferred link color of the platform.
Note that clients that use this style, such as StyledText
,
will include code to track the mouse and change the cursor to the hand
cursor when mouse is over the link.
Used By:
TextStyle
public static final int BORDER_SOLID
Used By:
TextStyle
public static final int BORDER_DASH
Used By:
TextStyle
public static final int BORDER_DOT
Used By:
TextStyle
public javafx.scene.text.Font font
public javafx.scene.paint.Color foreground
public javafx.scene.paint.Color background
public boolean underline
TextStyle.UNDERLINE_SINGLE
.public javafx.scene.paint.Color underlineColor
public int underlineStyle
underline
is
false.UNDERLINE_SINGLE
,
UNDERLINE_DOUBLE
,
UNDERLINE_ERROR
,
UNDERLINE_SQUIGGLE
,
UNDERLINE_LINK
public boolean strikeout
public javafx.scene.paint.Color strikeoutColor
public int borderStyle
SWT.NONE
.
This value should be one of SWT.BORDER_SOLID
,
SWT.BORDER_DASH
,SWT.BORDER_DOT
or
SWT.NONE
.
public javafx.scene.paint.Color borderColor
public int rise
public java.lang.Object data
GlyphMetrics
.
public java.lang.String stylename
public java.lang.String hoverStylename
public TextStyle(java.lang.String stylename)
stylename
- the css stylenamepublic TextStyle(java.lang.String stylename, javafx.scene.text.Font font, javafx.scene.paint.Color foreground, javafx.scene.paint.Color background)
stylename
- the css stylenamefont
- the font of the style, null
if noneforeground
- the foreground color of the style, null
if nonebackground
- the background color of the style, null
if nonepublic TextStyle(TextStyle style)
style
- the style to copypublic boolean equals(java.lang.Object object)
equals
in class java.lang.Object
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 java.lang.Object
equals(Object)
public java.lang.String toString()
toString
in class java.lang.Object
TextStyle