JET

edu.utep.cs.jet.gui.editor.syn
Class SyntaxStyle

java.lang.Object
  extended by edu.utep.cs.jet.gui.editor.syn.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.5 2008/05/01 21:19:35 cheon Exp $
Author:
Slava Pestov

Constructor Summary
SyntaxStyle(Color color, boolean italic, boolean bold)
          Creates a new SyntaxStyle.
 
Method Summary
 Color getColor()
          Returns the color specified in this style.
 FontMetrics getFontMetrics(Font font, JComponent comp)
          Returns the font metrics for the styled font.
 Font getStyledFont(Font font)
          Returns the specified font, but with the style's bold and italic flags applied.
 boolean isBold()
          Returns true if boldface is enabled for this style.
 boolean isItalic()
          Returns true if italics is enabled for this style.
 boolean isPlain()
          Returns true if no font styles are enabled.
 void setColor(Color color)
          Sets the color for this style.
 void setGraphicsFlags(Graphics gfx, Font font)
          Sets the foreground color and font of the specified graphics context to that specified in this style.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 Detail

getColor

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


setColor

public void setColor(Color color)
Sets the color for this style.


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,
                                  JComponent comp)
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

JET

JET is Copyright (C) 2005-2008 by The University of Texas at El Paso and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.