public class TextFormat extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TextFormat.Alignment
Text alignment setting.
|
static class |
TextFormat.Rgb
Represents a RGB color value.
|
static class |
TextFormat.TextCase
Text case settings.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SIZE
Indicates that the default text size should be used.
|
Constructor and Description |
---|
TextFormat()
Constructs a default text format.
|
Modifier and Type | Method and Description |
---|---|
void |
bold()
Make the text bold.
|
TextFormat.Alignment |
getAlignment() |
TextFormat.Rgb |
getBackground() |
Object |
getCustomPropert(String propName) |
Map<String,Object> |
getCustomProperties() |
TextFormat.Rgb |
getForeground() |
int |
getSize() |
TextFormat.TextCase |
getTextCase() |
boolean |
isBold() |
boolean |
isItalic() |
boolean |
isUnderline() |
void |
italic()
Make the text italic.
|
void |
reset()
Resets to the default alignment, size, style, and case.
|
void |
setAlignment(TextFormat.Alignment newAlignment) |
void |
setBackground(TextFormat.Rgb newBackground) |
void |
setCustomProperty(String propName,
Object value)
A
null value will remove the property; while a null property name does nothing. |
void |
setForeground(TextFormat.Rgb newForeground) |
void |
setTextCase(TextFormat.TextCase newTextCase) |
void |
unBold()
Make the text not bold.
|
void |
underline()
Make the text underlined.
|
void |
unItalic()
Make the text not italic.
|
void |
unUnderline()
Make the text not underlined.
|
public static final int DEFAULT_SIZE
public void bold()
public TextFormat.Alignment getAlignment()
null
)public TextFormat.Rgb getBackground()
null
if the default color should be used)public Object getCustomPropert(String propName)
propName
- the name of the custom property (can be empty)null
if not found or if the property name is emptypublic Map<String,Object> getCustomProperties()
null
but can be empty)public TextFormat.Rgb getForeground()
null
if the default color should be used)public int getSize()
public TextFormat.TextCase getTextCase()
null
)public boolean isBold()
true
if the style is boldpublic boolean isItalic()
true
if the style is italicpublic boolean isUnderline()
true
if the style is underlinepublic void italic()
public void reset()
public void setAlignment(TextFormat.Alignment newAlignment)
newAlignment
- the new alignment (can be null
)public void setBackground(TextFormat.Rgb newBackground)
newBackground
- the new background color (can be null
)public void setCustomProperty(String propName, Object value)
null
value will remove the property; while a null
property name does nothing.propName
- the name of the custom property (can be empty)value
- the property value (can be null
)public void setForeground(TextFormat.Rgb newForeground)
newForeground
- the new foreground color (can be null
)public void setTextCase(TextFormat.TextCase newTextCase)
newTextCase
- the new case (can be null
)public void unBold()
public void underline()
public void unItalic()
public void unUnderline()
Copyright © 2013–2019. All rights reserved.