public class Theme extends Object
SyntaxHighlighterPane and
JTextComponentRowHeader.
To make a new theme, either extending this class or initiate this class and
set parameters using setters. For the default value, find the comment of the
constructor.| Modifier and Type | Field and Description |
|---|---|
protected Color |
background
The background color of the script text area.
|
protected Font |
font
The font of the script text.
|
protected Color |
gutterBorderColor
The color of the border that joint the gutter and the script text area.
|
protected int |
gutterBorderWidth
The width of the border that joint the gutter and the script text area.
|
protected Color |
gutterText
The color of the gutter text.
|
protected Font |
gutterTextFont
The font of the gutter text.
|
protected int |
gutterTextPaddingLeft
The minimum padding from 'the leftmost of the line number text' to
'the left margin'.
|
protected int |
gutterTextPaddingRight
The minimum padding from 'the rightmost of the line number text' to
'the right margin' (not to the gutter border).
|
protected Color |
highlightedBackground
The background color of the highlighted line of script text.
|
protected Style |
plain
The default style.
|
protected Map<String,Style> |
styles
The styles of this theme.
|
| Constructor and Description |
|---|
Theme()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Style |
addStyle(String styleKey,
Style style)
Add style.
|
void |
clearStyles()
Clear all styles.
|
Theme |
clone() |
Color |
getBackground()
The background color of the script text area.
|
Font |
getFont()
The font of the script text.
|
Color |
getGutterBorderColor()
The color of the border that joint the gutter and the script text area.
|
int |
getGutterBorderWidth()
The width of the border that joint the gutter and the script text area.
|
Color |
getGutterText()
The color of the gutter text.
|
Font |
getGutterTextFont()
The font of the gutter text.
|
int |
getGutterTextPaddingLeft()
The minimum padding from 'the leftmost of the line number text' to
'the left margin'.
|
int |
getGutterTextPaddingRight()
The minimum padding from 'the rightmost of the line number text' to
'the right margin' (not to the gutter border).
|
Color |
getHighlightedBackground()
The background color of the highlighted line of script text.
|
Style |
getPlain()
Get the default style.
|
Style |
getStyle(String key)
Get the style by keyword.
|
Map<String,Style> |
getStyles()
Get all styles.
|
SimpleAttributeSet |
getStylesAttributeSet(String styleKeys)
Get the
AttributeSet of styleKeys. |
Style |
removeStyle(String styleKey)
Remove style by keyword.
|
void |
setBackground(Color background)
The background color of the script text area.
|
void |
setFont(Font font)
The font of the script text.
|
void |
setGutterBorderColor(Color gutterBorderColor)
The color of the border that joint the gutter and the script text area.
|
void |
setGutterBorderWidth(int gutterBorderWidth)
The width of the border that joint the gutter and the script text area.
|
void |
setGutterText(Color gutterText)
The color of the gutter text.
|
void |
setGutterTextFont(Font gutterTextFont)
The font of the gutter text.
|
void |
setGutterTextPaddingLeft(int gutterTextPaddingLeft)
The minimum padding from 'the leftmost of the line number text' to
'the left margin'.
|
void |
setGutterTextPaddingRight(int gutterTextPaddingRight)
The minimum padding from 'the rightmost of the line number text' to
'the right margin' (not to the gutter border).
|
void |
setHighlightedBackground(Color highlightedBackground)
The background color of the highlighted line of script text.
|
void |
setPlain(Style plain)
Set the default style.
|
void |
setTheme(JTextComponentRowHeader rowHeader)
Apply the theme to the row header panel.
|
String |
toString() |
protected Font font
protected Color background
protected Color highlightedBackground
protected Color gutterText
protected Color gutterBorderColor
protected int gutterBorderWidth
protected Font gutterTextFont
protected int gutterTextPaddingLeft
protected int gutterTextPaddingRight
protected Style plain
getStyle(String)
not exist, this will be returned.public Theme()
Default value:
public void setTheme(JTextComponentRowHeader rowHeader)
rowHeader - the row header to apply the theme onpublic void setPlain(Style plain)
plain - the stylepublic Style getPlain()
public SimpleAttributeSet getStylesAttributeSet(String styleKeys)
AttributeSet of styleKeys. For more than one
styles, separate the styles by space, e.g. 'plain comments'.styleKeys - the style keys with keys separated by spaceAttributeSetpublic Style addStyle(String styleKey, Style style)
styleKey - the keyword of the stylestyle - the styleMap.put(Object, Object)public Style removeStyle(String styleKey)
styleKey - the keyword of the styleMap.remove(Object)public Style getStyle(String key)
key - the keywordsyntaxhighlighter.theme.Style related to the
key; if the style related to the key not exist, the
style of 'plain' will return.public void clearStyles()
public Font getFont()
public void setFont(Font font)
font - the fontpublic Color getBackground()
public void setBackground(Color background)
background - the colorpublic Color getHighlightedBackground()
public void setHighlightedBackground(Color highlightedBackground)
highlightedBackground - the colorpublic Color getGutterText()
public void setGutterText(Color gutterText)
gutterText - the colorpublic Color getGutterBorderColor()
public void setGutterBorderColor(Color gutterBorderColor)
gutterBorderColor - the colorpublic int getGutterBorderWidth()
public void setGutterBorderWidth(int gutterBorderWidth)
gutterBorderWidth - in pixelpublic Font getGutterTextFont()
public void setGutterTextFont(Font gutterTextFont)
gutterTextFont - the fontpublic int getGutterTextPaddingLeft()
public void setGutterTextPaddingLeft(int gutterTextPaddingLeft)
gutterTextPaddingLeft - in pixelpublic int getGutterTextPaddingRight()
public void setGutterTextPaddingRight(int gutterTextPaddingRight)
gutterTextPaddingRight - in pixelCopyright © 2015. All rights reserved.