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.
TextLayout
,
Font
,
Color
,
TextLayout, TextStyle snippets,
Sample code and further informationModifier and Type | Field and Description |
---|---|
Color |
background
the background of the style
|
Color |
borderColor
the border color of the style
|
int |
borderStyle
the border style.
|
java.lang.Object |
data
the data.
|
Font |
font
the font of the style
|
Color |
foreground
the foreground of the style
|
GlyphMetrics |
metrics
the GlyphMetrics of the style
|
int |
rise
the baseline rise of the style.
|
boolean |
strikeout
the strikeout flag of the style
|
Color |
strikeoutColor
the strikeout color of the style
|
boolean |
underline
the underline flag of the style.
|
Color |
underlineColor
the underline color of the style
|
int |
underlineStyle
the underline style.
|
Constructor and Description |
---|
TextStyle()
Create an empty text style.
|
TextStyle(Font font,
Color foreground,
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.
|
(package private) boolean |
isAdherentBorder(TextStyle style) |
(package private) boolean |
isAdherentStrikeout(TextStyle style) |
(package private) boolean |
isAdherentUnderline(TextStyle style) |
java.lang.String |
toString()
Returns a string containing a concise, human-readable
description of the receiver.
|
public Font font
public Color foreground
public Color background
public boolean underline
SWT.UNDERLINE_SINGLE
.public Color underlineColor
public int underlineStyle
underline
is false.
This value should be one of SWT.UNDERLINE_SINGLE
,
SWT.UNDERLINE_DOUBLE
, SWT.UNDERLINE_ERROR
,
SWT.UNDERLINE_SQUIGGLE
, or SWT.UNDERLINE_LINK
.
SWT.UNDERLINE_SINGLE
,
SWT.UNDERLINE_DOUBLE
,
SWT.UNDERLINE_ERROR
,
SWT.UNDERLINE_SQUIGGLE
,
SWT.UNDERLINE_LINK
public boolean strikeout
public 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
.
SWT.BORDER_SOLID
,
SWT.BORDER_DASH
,
SWT.BORDER_DOT
,
SWT.NONE
public Color borderColor
public GlyphMetrics metrics
public int rise
public java.lang.Object data
GlyphMetrics
.
public TextStyle()
public TextStyle(Font font, Color foreground, Color background)
font
- 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)
boolean isAdherentBorder(TextStyle style)
boolean isAdherentUnderline(TextStyle style)
boolean isAdherentStrikeout(TextStyle style)
public java.lang.String toString()
toString
in class java.lang.Object
TextStyle