public class TextStyle
extends java.lang.Object
Constructor and Description |
---|
TextStyle()
Constructs a new TextStyle with default font (device-dependent), black
foreground, transparent background, default alignment, and the strikeout
and underline flags set to false.
|
Modifier and Type | Method and Description |
---|---|
TextStyle |
align(int alignment)
Returns a copy of this TextStyle, with the alignment changed to the
argument.
|
TextStyle |
background(int rgb)
Returns a copy of this TextStyle, with the background changed to the
color described by the argument.
|
TextStyle |
background(int red,
int green,
int blue)
Returns a copy of this TextStyle, with the background changed to the
color described by the arguments.
|
TextStyle |
background(org.eclipse.swt.graphics.RGB background)
Returns a copy of this TextStyle, with the background changed to the
argument.
|
TextPrint |
create(java.lang.String text)
Returns a TextPrint of the given text in this text style
|
boolean |
equals(java.lang.Object obj) |
TextStyle |
font(org.eclipse.swt.graphics.FontData fontData)
Returns a copy of this TextStyle, with the font changed to the argument.
|
TextStyle |
font(java.lang.String name,
int height,
int style)
Returns a copy of this TextStyle, with the font changed to the font
described by the arguments.
|
TextStyle |
fontHeight(int height)
Returns a copy of this TextStyle, with the font height changed to the
argument.
|
TextStyle |
fontName(java.lang.String name)
Returns a copy of this TextStyle, with the font name changed to the
argument.
|
TextStyle |
fontStyle(int style)
Returns a copy of this TextStyle, with the font style changed to the
argument.
|
TextStyle |
foreground(int rgb)
Returns a copy of this TextStyle, with the foreground changed to the
color described by the argument.
|
TextStyle |
foreground(int red,
int green,
int blue)
Returns a copy of this TextStyle, with the foreground changed to the
color described by the arguments.
|
TextStyle |
foreground(org.eclipse.swt.graphics.RGB foreground)
Returns a copy of this TextStyle, with the foreground changed to the
argument.
|
int |
getAlignment()
Returns the text alignment.
|
org.eclipse.swt.graphics.RGB |
getBackground()
Returns the text background color.
|
org.eclipse.swt.graphics.FontData |
getFontData()
Returns the font applied to the text.
|
org.eclipse.swt.graphics.RGB |
getForeground()
Returns the text foreground color.
|
boolean |
getStrikeout()
Returns the strikeout flag.
|
boolean |
getUnderline()
Returns the underline flag.
|
int |
hashCode() |
TextStyle |
strikeout()
Returns a copy of this TextStyle, with the strikeout flag set to true.
|
TextStyle |
strikeout(boolean strikeout)
Returns a copy of this TextStyle, with the strikeout flag set to the
argument.
|
TextStyle |
underline()
Returns a copy of this TextStyle, with the underline flag set to true.
|
TextStyle |
underline(boolean underline)
Returns a copy of this TextStyle, with the underline flag set to the
argument.
|
public TextStyle()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public TextStyle font(java.lang.String name, int height, int style)
name
- the name of the font (must not be null)height
- the font height in pointsstyle
- a bit or combination of NORMAL, BOLD, ITALICpublic TextStyle font(org.eclipse.swt.graphics.FontData fontData)
fontData
- the new font. A null value causes the font to be inherited
from the enclosing elements of the document.public TextStyle fontName(java.lang.String name)
name
- the new font name (must not be null)public TextStyle fontHeight(int height)
height
- the new font height in pointspublic TextStyle fontStyle(int style)
style
- a bit or combination of NORMAL, BOLD, ITALICpublic TextStyle foreground(org.eclipse.swt.graphics.RGB foreground)
foreground
- the new foreground. A null value causes the foreground to be
inherited from the enclosing elements of the document.public TextStyle foreground(int red, int green, int blue)
red
- the red component of the new foreground colorgreen
- the green component of the new foreground colorblue
- the blue component of the new foreground colorpublic TextStyle foreground(int rgb)
rgb
- an integer containing the red, green and blue components in
the 0xFF0000, 0x00FF00, and 0x0000FF positions, respectively.public TextStyle background(org.eclipse.swt.graphics.RGB background)
background
- the new background. A null value causes the text background to
be transparent.public TextStyle background(int red, int green, int blue)
red
- the red component of the new background colorgreen
- the green component of the new background colorblue
- the blue component of the new background colorpublic TextStyle background(int rgb)
rgb
- an integer containing the red, green and blue components in
the 0xFF0000, 0x00FF00, and 0x0000FF positions, respectively.public TextStyle align(int alignment)
alignment
- the new alignment. Must be one of SWT.LEFT, SWT.CENTER, or
SWT.RIGHT. Invalid values will be changed to SWT.LEFT.public TextStyle underline()
public TextStyle underline(boolean underline)
underline
- the new underline flag.public TextStyle strikeout()
public TextStyle strikeout(boolean strikeout)
strikeout
- the new strikeout flag.public org.eclipse.swt.graphics.FontData getFontData()
public org.eclipse.swt.graphics.RGB getForeground()
public org.eclipse.swt.graphics.RGB getBackground()
public int getAlignment()
public boolean getUnderline()
public boolean getStrikeout()
public TextPrint create(java.lang.String text)
text
- the text