Top Description Fields Constructors Methods
org.eclipse.swt.graphics

public Class TextStyle

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.swt.custom.StyleRange
Imports
org.eclipse.swt.*

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.

Since
3.0
See Also
TextLayout, Font, Color, TextLayout, TextStyle snippets, Sample code and further information

Field Summary

Modifier and TypeField and Description
public Color
background

the background of the style

public Color
borderColor

the border color of the style

public int
borderStyle

the border style.

public Object
data

the data.

public Font
font

the font of the style

public Color
foreground

the foreground of the style

public GlyphMetrics
metrics

the GlyphMetrics of the style

public int
rise

the baseline rise of the style.

public boolean
strikeout

the strikeout flag of the style

public Color
strikeoutColor

the strikeout color of the style

public boolean
underline

the underline flag of the style.

public Color
underlineColor

the underline color of the style

public int
underlineStyle

the underline style.

Constructor Summary

AccessConstructor and Description
public
TextStyle()

Create an empty text style.

public
TextStyle(Font
the font of the style, null if none
font
,
Color
the foreground color of the style, null if none
foreground
,
Color
the background color of the style, null if none
background
)

Create a new text style with the specified font, foreground and background.

public
TextStyle(TextStyle
the style to copy
style
)

Create a new text style from an existing text style.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the object is the same as this object and false otherwise
equals
(Object
the object to compare with this object
object
)

Overrides java.lang.Object.equals.

Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
public int

Returns:

the receiver's hash
hashCode
()

Overrides java.lang.Object.hashCode.

Returns an integer hash code for the receiver.
pack-priv boolean
pack-priv boolean
pack-priv boolean
public String

Returns:

a string representation of the TextStyle
toString
()

Overrides java.lang.Object.toString.

Returns a string containing a concise, human-readable description of the receiver.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

backgroundback to summary
public Color background

the background of the style

borderColorback to summary
public Color borderColor

the border color of the style

Since
3.4
borderStyleback to summary
public int borderStyle

the border style. The default border style is SWT.NONE.

This value should be one of SWT.BORDER_SOLID, SWT.BORDER_DASH,SWT.BORDER_DOT or SWT.NONE.

Since
3.4
See Also
SWT#BORDER_SOLID, SWT#BORDER_DASH, SWT#BORDER_DOT, SWT#NONE
databack to summary
public Object data

the data. An user data field. It can be used to hold the HREF when the range is used as a link or the embed object when the range is used with GlyphMetrics.

Since
3.5
fontback to summary
public Font font

the font of the style

foregroundback to summary
public Color foreground

the foreground of the style

metricsback to summary
public GlyphMetrics metrics

the GlyphMetrics of the style

Since
3.2
riseback to summary
public int rise

the baseline rise of the style.

Since
3.2
strikeoutback to summary
public boolean strikeout

the strikeout flag of the style

Since
3.1
strikeoutColorback to summary
public Color strikeoutColor

the strikeout color of the style

Since
3.4
underlineback to summary
public boolean underline

the underline flag of the style. The default underline style is SWT.UNDERLINE_SINGLE.

Since
3.1
underlineColorback to summary
public Color underlineColor

the underline color of the style

Since
3.4
underlineStyleback to summary
public int underlineStyle

the underline style. This style is ignored when 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.

Since
3.4
See Also
SWT#UNDERLINE_SINGLE, SWT#UNDERLINE_DOUBLE, SWT#UNDERLINE_ERROR, SWT#UNDERLINE_SQUIGGLE, SWT#UNDERLINE_LINK

Constructor Detail

TextStyleback to summary
public TextStyle()

Create an empty text style.

Since
3.4
TextStyleback to summary
public TextStyle(Font font, Color foreground, Color background)

Create a new text style with the specified font, foreground and background.

Parameters
font:Font

the font of the style, null if none

foreground:Color

the foreground color of the style, null if none

background:Color

the background color of the style, null if none

TextStyleback to summary
public TextStyle(TextStyle style)

Create a new text style from an existing text style.

Parameters
style:TextStyle

the style to copy

Since
3.4

Method Detail

equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

Parameters
object:Object

the object to compare with this object

Returns:boolean

true if the object is the same as this object and false otherwise

Annotations
@Override
See Also
hashCode()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns an integer hash code for the receiver. Any two objects that return true when passed to equals must return the same value for this method.

Returns:int

the receiver's hash

Annotations
@Override
See Also
equals(Object)
isAdherentBorderback to summary
pack-priv boolean isAdherentBorder(TextStyle style)
isAdherentStrikeoutback to summary
pack-priv boolean isAdherentStrikeout(TextStyle style)
isAdherentUnderlineback to summary
pack-priv boolean isAdherentUnderline(TextStyle style)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string containing a concise, human-readable description of the receiver.

Returns:String

a string representation of the TextStyle

Annotations
@Override