public final class StyleBuilder extends Object
Style
and related objects, like Style.Color
.Constructor and Description |
---|
StyleBuilder()
Constructs a new
StyleBuilder with the default foreground and
background colors. |
StyleBuilder(Style.Color defaultForegroundColor,
Style.Color defaultBackgroundColor)
Constructs a new
StyleBuilder with a specified default foreground
and background colors. |
Modifier and Type | Method and Description |
---|---|
StyleBuilder |
background(int r,
int g,
int b)
Sets the background (fill) color of the style
|
StyleBuilder |
background(short[] rgb)
Sets the background (fill) color of the style
|
StyleBuilder |
background(String rgbColorCode)
Sets the background (fill) color of the style
|
StyleBuilder |
background(Style.Color color)
Sets the background (fill) color of the style
|
StyleBuilder |
bold()
Sets the font weight to bold
|
StyleBuilder |
centerAligned()
Sets the text alignment to center
|
Style |
create()
Creates a
Style object based on the build characteristics. |
static Style.Color |
createColor(int r,
int g,
int b)
Creates a color based on 3 RGB components, represented as ints
|
static Style.Color |
createColor(short r,
short g,
short b)
Creates a color based on 3 RGB components, represented as shorts
|
static Style.Color |
createColor(String rgbColorCode)
Creates a Color based on a 6-letter RGB hex color code string, eg.
|
StyleBuilder |
fontSize(int fontSize,
Style.SizeUnit sizeUnit)
Sets the font size of the style
|
StyleBuilder |
foreground(int r,
int g,
int b)
Sets the foreground (text) color of the style
|
StyleBuilder |
foreground(short[] rgb)
Sets the foreground (text) color of the style
|
StyleBuilder |
foreground(String rgbColorCode)
Sets the foreground (text) color of the style
|
StyleBuilder |
foreground(Style.Color color)
Sets the foreground (text) color of the style
|
StyleBuilder |
italic()
Sets the font style to italic
|
StyleBuilder |
justifyAligned()
Sets the text alignment to justify
|
StyleBuilder |
leftAligned()
Sets the text alignment to left
|
void |
reset()
Resets the state of the built style, which will conceptually match it
with
Style.NO_STYLE . |
StyleBuilder |
rightAligned()
Sets the text alignment to right
|
StyleBuilder |
underline()
Sets the text decoration to underlined
|
public StyleBuilder()
StyleBuilder
with the default foreground and
background colors.public StyleBuilder(Style.Color defaultForegroundColor, Style.Color defaultBackgroundColor)
StyleBuilder
with a specified default foreground
and background colors. These colors will be disregarded, if posted to the
foreground and background methods.defaultForegroundColor
- defaultBackgroundColor
- public void reset()
Style.NO_STYLE
.public Style create()
Style
object based on the build characteristics.Style
object based on the build characteristics.public StyleBuilder bold()
StyleBuilder
self (for cascading method calls)public StyleBuilder italic()
StyleBuilder
self (for cascading method calls)public StyleBuilder underline()
StyleBuilder
self (for cascading method calls)public static Style.Color createColor(String rgbColorCode)
rgbColorCode
- a 6-letter RGB hex color code stringpublic static Style.Color createColor(int r, int g, int b)
r
- g
- b
- public static Style.Color createColor(short r, short g, short b)
r
- g
- b
- public StyleBuilder foreground(String rgbColorCode)
rgbColorCode
- a 6-letter hex RGB color code, such as FF0000 (red).StyleBuilder
self (for cascading method calls)public StyleBuilder foreground(short[] rgb)
rgb
- a triplet array of shortsStyleBuilder
self (for cascading method calls)public StyleBuilder foreground(int r, int g, int b)
r
- red amount (0-255)g
- green amount (0-255)b
- blue amount (0-255)StyleBuilder
self (for cascading method calls)public StyleBuilder foreground(Style.Color color)
color
- the color to useStyleBuilder
self (for cascading method calls)public StyleBuilder background(String rgbColorCode)
rgbColorCode
- a 6-letter hex RGB color code, such as FF0000 (red).StyleBuilder
self (for cascading method calls)public StyleBuilder background(short[] rgb)
rgb
- a triplet array of shortsStyleBuilder
self (for cascading method calls)public StyleBuilder background(int r, int g, int b)
r
- red amount (0-255)g
- green amount (0-255)b
- blue amount (0-255)StyleBuilder
self (for cascading method calls)public StyleBuilder background(Style.Color color)
color
- the color to useStyleBuilder
self (for cascading method calls)public StyleBuilder fontSize(int fontSize, Style.SizeUnit sizeUnit)
fontSize
- the font sizesizeUnit
- the font size unitStyleBuilder
self (for cascading method calls)public StyleBuilder centerAligned()
StyleBuilder
self (for cascading method calls)public StyleBuilder leftAligned()
StyleBuilder
self (for cascading method calls)public StyleBuilder rightAligned()
StyleBuilder
self (for cascading method calls)public StyleBuilder justifyAligned()
StyleBuilder
self (for cascading method calls)Copyright © 2007–2017 The Apache Software Foundation. All rights reserved.