Class SyntaxStyle


  • public class SyntaxStyle
    extends java.lang.Object
    A simple text style class. It can specify the color, italic flag, and bold flag of a run of text.
    • Constructor Summary

      Constructors 
      Constructor Description
      SyntaxStyle​(java.awt.Color color, boolean italic, boolean bold)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.Color getColor()
      Returns the text color.
      java.awt.FontMetrics getFontMetrics​(java.awt.Font font, java.awt.Graphics g)
      Returns the font metrics for the styled font.
      boolean isBold()
      Returns true if boldface is enabled.
      boolean isItalic()
      Returns true if italics is enabled.
      boolean isPlain()
      Returns true if no font styles are enabled.
      void setGraphicsFlags​(java.awt.Graphics gfx, java.awt.Font font)
      Sets the text color and font of the specified graphics context to that specified in this style.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SyntaxStyle

        public SyntaxStyle​(java.awt.Color color,
                           boolean italic,
                           boolean bold)
        Creates a new instance.
        Parameters:
        color - the text color
        italic - whether the text should be italics
        bold - whether the text should be bold
    • Method Detail

      • getColor

        public java.awt.Color getColor()
        Returns the text color.
        Returns:
        the text color
      • isPlain

        public boolean isPlain()
        Returns true if no font styles are enabled.
        Returns:
        whether no font styles are enabled
      • isItalic

        public boolean isItalic()
        Returns true if italics is enabled.
        Returns:
        the italics flag
      • isBold

        public boolean isBold()
        Returns true if boldface is enabled.
        Returns:
        the bold flag
      • getFontMetrics

        public java.awt.FontMetrics getFontMetrics​(java.awt.Font font,
                                                   java.awt.Graphics g)
        Returns the font metrics for the styled font.
        Parameters:
        font - the styled font
        g - the graphics to use
        Returns:
        the font metrics
      • setGraphicsFlags

        public void setGraphicsFlags​(java.awt.Graphics gfx,
                                     java.awt.Font font)
        Sets the text color and font of the specified graphics context to that specified in this style.
        Parameters:
        gfx - the graphics context that should be modified
        font - the font to add the styles to
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object