Package org.fife.ui.rsyntaxtextarea
Class Style
- java.lang.Object
-
- org.fife.ui.rsyntaxtextarea.Style
-
- All Implemented Interfaces:
java.lang.Cloneable
public class Style extends java.lang.Object implements java.lang.CloneableThe color and style information for a token type. Each token type in anRSyntaxTextAreahas a correspondingStyle; thisStyletells us the following things:- What foreground color to use for tokens of this type.
- What background color to use.
- The font to use.
- Whether the token should be underlined.
- Version:
- 0.6
-
-
Field Summary
Fields Modifier and Type Field Description java.awt.Colorbackgroundstatic java.awt.ColorDEFAULT_BACKGROUNDstatic java.awt.FontDEFAULT_FONTstatic java.awt.ColorDEFAULT_FOREGROUNDjava.awt.Fontfontjava.awt.FontMetricsfontMetricsjava.awt.Colorforegroundbooleanunderline
-
Constructor Summary
Constructors Constructor Description Style()Creates a new style defaulting to black foreground, no background, and no styling.Style(java.awt.Color fg)Creates a new style with the specified foreground and no styling.Style(java.awt.Color fg, java.awt.Color bg)Creates a new style with the specified colors and no styling.Style(java.awt.Color fg, java.awt.Color bg, java.awt.Font font)Creates a new style.Style(java.awt.Color fg, java.awt.Color bg, java.awt.Font font, boolean underline)Creates a new style.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanareEqual(java.lang.Object o1, java.lang.Object o2)Returns whether two (possiblynull) objects are equal.java.lang.Objectclone()Returns a deep copy of this object.booleanequals(java.lang.Object o2)Returns whether two syntax schemes are equal.inthashCode()Computes the hash code to use when adding this syntax scheme to hash tables.java.lang.StringtoString()Returns a string representation of this style.
-
-
-
Field Detail
-
DEFAULT_FOREGROUND
public static final java.awt.Color DEFAULT_FOREGROUND
-
DEFAULT_BACKGROUND
public static final java.awt.Color DEFAULT_BACKGROUND
-
DEFAULT_FONT
public static final java.awt.Font DEFAULT_FONT
-
foreground
public java.awt.Color foreground
-
background
public java.awt.Color background
-
underline
public boolean underline
-
font
public java.awt.Font font
-
fontMetrics
public java.awt.FontMetrics fontMetrics
-
-
Constructor Detail
-
Style
public Style()
Creates a new style defaulting to black foreground, no background, and no styling.
-
Style
public Style(java.awt.Color fg)
Creates a new style with the specified foreground and no styling.- Parameters:
fg- The foreground color to use.
-
Style
public Style(java.awt.Color fg, java.awt.Color bg)Creates a new style with the specified colors and no styling.- Parameters:
fg- The foreground color to use.bg- The background color to use.
-
Style
public Style(java.awt.Color fg, java.awt.Color bg, java.awt.Font font)Creates a new style.- Parameters:
fg- The foreground color to use.bg- The background color to use.font- The font for this syntax scheme.
-
Style
public Style(java.awt.Color fg, java.awt.Color bg, java.awt.Font font, boolean underline)Creates a new style.- Parameters:
fg- The foreground color to use.bg- The background color to use.font- The font for this syntax scheme.underline- Whether to underline tokens with this style.
-
-
Method Detail
-
areEqual
private boolean areEqual(java.lang.Object o1, java.lang.Object o2)Returns whether two (possiblynull) objects are equal.
-
clone
public java.lang.Object clone()
Returns a deep copy of this object.- Overrides:
clonein classjava.lang.Object- Returns:
- The copy.
-
equals
public boolean equals(java.lang.Object o2)
Returns whether two syntax schemes are equal.- Overrides:
equalsin classjava.lang.Object- Parameters:
o2- The object with which to compare this syntax scheme.- Returns:
- Whether these two syntax schemes represent the same scheme.
-
hashCode
public int hashCode()
Computes the hash code to use when adding this syntax scheme to hash tables.This method is implemented, since
equals(Object)is implemented, to keep FindBugs happy.- Overrides:
hashCodein classjava.lang.Object- Returns:
- The hash code.
-
toString
public java.lang.String toString()
Returns a string representation of this style.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of this style.
-
-