Package jsyntaxpane

Class 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 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:
      • 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: