org.fife.ui.rsyntaxtextarea
Class SyntaxScheme

java.lang.Object
  extended by org.fife.ui.rsyntaxtextarea.SyntaxScheme
All Implemented Interfaces:
java.lang.Cloneable

public class SyntaxScheme
extends java.lang.Object
implements java.lang.Cloneable

The set of colors and styles used by an RSyntaxTextArea to color tokens.

Version:
1.0
Author:
Robert Futrell

Field Summary
 Style[] styles
           
 
Constructor Summary
SyntaxScheme(boolean useDefaults)
          Creates a color scheme that either has all color values set to a default value or set to null.
 
Method Summary
 java.lang.Object clone()
          Returns a deep copy of this color scheme.
 boolean equals(java.lang.Object otherScheme)
          Tests whether this color scheme is the same as another color scheme.
 int hashCode()
          This is implemented to be consistent with equals(Object).
static SyntaxScheme loadFromString(java.lang.String string)
          Loads a syntax highlighting color scheme from a string created from toCommaSeparatedString.
 void restoreDefaults()
          Restores all colors and fonts to their default values.
 void setStyle(int type, Style style)
          Sets a style to use when rendering a token type.
 java.lang.String toCommaSeparatedString()
          Returns this syntax highlighting scheme as a comma-separated list of values as follows: If a color is non-null, it is added as a 24-bit integer of the form ((r<<16) | (g<<8) | (b)); if it is null, it is added as "-,".
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

styles

public Style[] styles
Constructor Detail

SyntaxScheme

public SyntaxScheme(boolean useDefaults)
Creates a color scheme that either has all color values set to a default value or set to null.

Parameters:
useDefaults - If true, all color values will be set to default colors; if false, all colors will be initially null.
Method Detail

clone

public java.lang.Object clone()
Returns a deep copy of this color scheme.

Overrides:
clone in class java.lang.Object
Returns:
The copy.

equals

public boolean equals(java.lang.Object otherScheme)
Tests whether this color scheme is the same as another color scheme.

Overrides:
equals in class java.lang.Object
Parameters:
otherScheme - The color scheme to compare to.
Returns:
true if this color scheme and otherScheme are the same scheme; false otherwise.

hashCode

public int hashCode()
This is implemented to be consistent with equals(Object). This is a requirement to keep FindBugs happy.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code for this object.

loadFromString

public static SyntaxScheme loadFromString(java.lang.String string)
Loads a syntax highlighting color scheme from a string created from toCommaSeparatedString. This method is useful for saving and restoring color schemes.

Parameters:
string - A string generated from toCommaSeparatedString().
Returns:
A color scheme.

restoreDefaults

public void restoreDefaults()
Restores all colors and fonts to their default values.


setStyle

public void setStyle(int type,
                     Style style)
Sets a style to use when rendering a token type.

Parameters:
type - The token type.
style - The style for the token type.

toCommaSeparatedString

public java.lang.String toCommaSeparatedString()
Returns this syntax highlighting scheme as a comma-separated list of values as follows:

Returns:
A string representing the rgb values of the colors.