Package jsyntaxpane
Class SyntaxStyles
- java.lang.Object
-
- jsyntaxpane.SyntaxStyles
-
public class SyntaxStyles extends java.lang.Object
The Styles to use for each TokenType. The defaults are created here, and then the resource META-INF/services/syntaxstyles.properties is read and merged. You can also pass a properties instance and merge your prefered styles into the default styles. Text is drawn by forwarding the drawText request to the SyntaxStyle for the that matches the given TokenType
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.Pattern
STYLE_PATTERN
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
drawText(javax.swing.text.Segment segment, int x, int y, java.awt.Graphics graphics, javax.swing.text.TabExpander e, Token token)
Draw the given Token.static SyntaxStyles
getInstance()
Returns the Default SingletonSyntaxStyle
getStyle(TokenType type)
Return the style for the given TokenTypevoid
mergeStyles(java.util.Properties styles)
You can call the mergeStyles method with a Properties file to customize the existing styles.void
put(TokenType type, SyntaxStyle style)
static SyntaxStyles
read(Configuration config)
-
-
-
Method Detail
-
mergeStyles
public void mergeStyles(java.util.Properties styles)
You can call the mergeStyles method with a Properties file to customize the existing styles. Any existing styles will be overwritten by the styles you provide.- Parameters:
styles
-
-
getInstance
public static SyntaxStyles getInstance()
Returns the Default Singleton- Returns:
-
read
public static SyntaxStyles read(Configuration config)
-
put
public void put(TokenType type, SyntaxStyle style)
-
getStyle
public SyntaxStyle getStyle(TokenType type)
Return the style for the given TokenType- Parameters:
type
-- Returns:
-
drawText
public int drawText(javax.swing.text.Segment segment, int x, int y, java.awt.Graphics graphics, javax.swing.text.TabExpander e, Token token)
Draw the given Token. This will simply find the proper SyntaxStyle for the TokenType and then asks the proper Style to draw the text of the Token.- Parameters:
segment
-x
-y
-graphics
-e
-token
-- Returns:
-
-