Class SyntaxStyle

java.lang.Object
mars.venus.editors.jeditsyntax.SyntaxStyle

public class SyntaxStyle extends Object
A simple text style class. It can specify the color, italic flag, and bold flag of a run of text.
Version:
$Id: SyntaxStyle.java,v 1.6 1999/12/13 03:40:30 sp Exp $
Author:
Slava Pestov
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    Returns the color specified in this style.
    Returns the color coded as Stringified 32-bit hex with Red in bits 16-23, Green in bits 8-15, Blue in bits 0-7 e.g. "0x00FF3366" where Red is FF, Green is 33, Blue is 66.
    Returns the font metrics for the styled font.
    Returns the specified font, but with the style's bold and italic flags applied.
    boolean
    Returns true if boldface is enabled for this style.
    boolean
    Returns true if italics is enabled for this style.
    boolean
    Returns true if no font styles are enabled.
    void
    Sets the foreground color and font of the specified graphics context to that specified in this style.
    Returns a string representation of this object.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SyntaxStyle

      public SyntaxStyle(Color color, boolean italic, boolean bold)
      Creates a new SyntaxStyle.
      Parameters:
      color - The text color
      italic - True if the text should be italics
      bold - True if the text should be bold
  • Method Details

    • getColor

      public Color getColor()
      Returns the color specified in this style.
    • getColorAsHexString

      public String getColorAsHexString()
      Returns the color coded as Stringified 32-bit hex with Red in bits 16-23, Green in bits 8-15, Blue in bits 0-7 e.g. "0x00FF3366" where Red is FF, Green is 33, Blue is 66. This is used by Settings initialization to avoid direct use of Color class. Long story. DPS 13-May-2010
      Returns:
      String containing hex-coded color value.
    • isPlain

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

      public boolean isItalic()
      Returns true if italics is enabled for this style.
    • isBold

      public boolean isBold()
      Returns true if boldface is enabled for this style.
    • getStyledFont

      public Font getStyledFont(Font font)
      Returns the specified font, but with the style's bold and italic flags applied.
    • getFontMetrics

      public FontMetrics getFontMetrics(Font font)
      Returns the font metrics for the styled font.
    • setGraphicsFlags

      public void setGraphicsFlags(Graphics gfx, Font font)
      Sets the foreground color and font of the specified graphics context to that specified in this style.
      Parameters:
      gfx - The graphics context
      font - The font to add the styles to
    • toString

      public String toString()
      Returns a string representation of this object.
      Overrides:
      toString in class Object