Package org.fife.ui.rsyntaxtextarea
Class Theme
- java.lang.Object
-
- org.fife.ui.rsyntaxtextarea.Theme
-
public class Theme extends Object
A theme is a set of fonts and colors to use to style RSyntaxTextArea. Themes are defined in XML files that are validated againstthemes.dtd. This provides applications and other consumers with an easy way to style RSyntaxTextArea without having to use the API.Sample themes are included in the source tree under the
/themesfolder, but are not a part of the built RSyntaxTextArea jar. Hosting applications are free to ship and use these themes as-is, modify them, or create their own.Note that to save a
Themeviasave(OutputStream), you must currently create aThemefrom a text area wrapped in anRTextScrollPane, so that the color information for the gutter can be retrieved.
-
-
Constructor Summary
Constructors Constructor Description Theme(RSyntaxTextArea textArea)Creates a theme from an RSyntaxTextArea.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(RSyntaxTextArea textArea)Applies this theme to a text area.static Themeload(InputStream in)Loads a theme.static Themeload(InputStream in, Font baseFont)Loads a theme.voidsave(OutputStream out)Saves this theme to an output stream.
-
-
-
Constructor Detail
-
Theme
public Theme(RSyntaxTextArea textArea)
Creates a theme from an RSyntaxTextArea. It should be contained in anRTextScrollPaneto get all gutter color information.- Parameters:
textArea- The text area.
-
-
Method Detail
-
apply
public void apply(RSyntaxTextArea textArea)
Applies this theme to a text area.- Parameters:
textArea- The text area to apply this theme to.
-
load
public static Theme load(InputStream in) throws IOException
Loads a theme.- Parameters:
in- The input stream to read from. This will be closed when this method returns.- Returns:
- The theme.
- Throws:
IOException- If an IO error occurs.- See Also:
save(OutputStream)
-
load
public static Theme load(InputStream in, Font baseFont) throws IOException
Loads a theme.- Parameters:
in- The input stream to read from. This will be closed when this method returns.baseFont- The default font to use for any "base font" properties not specified in the theme XML. If this isnull, a default monospaced font will be used.- Returns:
- The theme.
- Throws:
IOException- If an IO error occurs.- See Also:
save(OutputStream)
-
save
public void save(OutputStream out) throws IOException
Saves this theme to an output stream.- Parameters:
out- The output stream to write to.- Throws:
IOException- If an IO error occurs.- See Also:
load(InputStream)
-
-