Package swingtree
Enum Class UI.FontStyle
- All Implemented Interfaces:
Serializable,Comparable<UI.FontStyle>,Constable,UIEnum<UI.FontStyle>
- Enclosing class:
UI
@Immutable
public static enum UI.FontStyle
extends Enum<UI.FontStyle>
implements UIEnum<UI.FontStyle>
Names how the glyphs of a font are drawn: upright and thin as
PLAIN,
thickened as BOLD, slanted as ITALIC, or both at once as
BOLD_ITALIC. There are four constants because boldness and slant are two
independent switches.
isBold() and isItalic() read those two switches back out, and
withBold(boolean) and withItalic(boolean) change one of them
while keeping the other, which is what a toolbar with a separate bold button and
italic button needs.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionGlyphs drawn with thickened strokes and upright.Glyphs drawn with thickened strokes and slanted.Glyphs drawn slanted and unthickened.Glyphs drawn upright and unthickened. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisBold()Tells whether this style draws its glyphs with thickened strokes.booleanisItalic()Tells whether this style draws its glyphs slanted.static UI.FontStyleReturns the enum constant of this class with the specified name.static UI.FontStyle[]values()Returns an array containing the constants of this enum class, in the order they are declared.withBold(boolean bold) Returns the style which is this one with boldness turned on or off and the slant left as it is.withItalic(boolean italic) Returns the style which is this one with the slant turned on or off and the boldness left as it is.
-
Enum Constant Details
-
PLAIN
Glyphs drawn upright and unthickened. -
BOLD
Glyphs drawn with thickened strokes and upright. -
ITALIC
Glyphs drawn slanted and unthickened. -
BOLD_ITALIC
Glyphs drawn with thickened strokes and slanted.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isBold
public boolean isBold()Tells whether this style draws its glyphs with thickened strokes.- Returns:
- True for
BOLDandBOLD_ITALIC.
-
isItalic
public boolean isItalic()Tells whether this style draws its glyphs slanted.- Returns:
- True for
ITALICandBOLD_ITALIC.
-
withBold
Returns the style which is this one with boldness turned on or off and the slant left as it is. Turning boldness on forITALICtherefore givesBOLD_ITALICrather thanBOLD, which is what a bold button sitting next to an italic button has to do.- Parameters:
bold- Whether the returned style should thicken its strokes.- Returns:
- The style with the requested boldness and the slant of this one.
-
withItalic
Returns the style which is this one with the slant turned on or off and the boldness left as it is. Turning the slant off forBOLD_ITALICtherefore givesBOLDrather thanPLAIN, which is what an italic button sitting next to a bold button has to do.- Parameters:
italic- Whether the returned style should slant its glyphs.- Returns:
- The style with the requested slant and the boldness of this one.
-