jsyntaxpane
Class SyntaxStyles

java.lang.Object
  extended by 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

Author:
Ayman Al-Sairafi

Field Summary
static java.util.regex.Pattern STYLE_PATTERN
           
 
Method Summary
 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 Singleton
 SyntaxStyle getStyle(TokenType type)
          Return the style for the given TokenType
 void 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STYLE_PATTERN

public static final java.util.regex.Pattern STYLE_PATTERN
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: