edu.princeton.swing.text
public class HighlightStyle extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static HighlightStyle |
DEFAULT_STYLE
The plain black style.
|
static char[] |
HEX_DIGITS
An array to convert an integer between 0 and 16 to a hexidecimal digit.
|
Constructor and Description |
---|
HighlightStyle(java.awt.Color color,
boolean bold,
boolean italic)
Instantiates a new HighlightStyle.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Returns true if two HighlightStyles are identical.
|
java.awt.Color |
getColor()
Returns the color which the highlighted text should take.
|
int |
getStyleMask()
Returns the style mask which can be sent straight to the constructor of Font.
|
static int |
hexDigitToInt(char c)
Returns the hexidecimal value of a character.
|
boolean |
isBold()
Returns wheter or not the highlighted text should be bold.
|
static boolean |
isHexDigit(char c)
Returns whether or not a character is a hexidecimal digit.
|
boolean |
isItalic()
Returns wheter or not the highlighted text should be italicized.
|
static HighlightStyle |
parseStyle(java.lang.String string)
Decodes the string produced by toString() back into a HighlightStyle.
|
java.lang.String |
toString()
Encodes the HighlightStyle in a format that can be read by parseStyle().
|
public static final char[] HEX_DIGITS
public static final HighlightStyle DEFAULT_STYLE
public HighlightStyle(java.awt.Color color, boolean bold, boolean italic)
public java.awt.Color getColor()
public boolean isBold()
public boolean isItalic()
public int getStyleMask()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to compare this HighlightStyle with.public java.lang.String toString()
toString
in class java.lang.Object
public static HighlightStyle parseStyle(java.lang.String string)
string
- The string to parse. A null value will result in a NullPointerException.public static boolean isHexDigit(char c)
c
- The character to test.public static int hexDigitToInt(char c)
c
- The character to convert. If this character is not a hex digit, an
IllegalArgumentException will be thrown.