Class SyntaxStyle
- java.lang.Object
-
- net.sf.gridarta.textedit.textarea.SyntaxStyle
-
public class SyntaxStyle extends java.lang.ObjectA 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.ColorgetColor()Returns the text color.java.awt.FontMetricsgetFontMetrics(java.awt.Font font, java.awt.Graphics g)Returns the font metrics for the styled font.booleanisBold()Returnstrueif boldface is enabled.booleanisItalic()Returnstrueif italics is enabled.booleanisPlain()Returnstrueif no font styles are enabled.voidsetGraphicsFlags(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.StringtoString()
-
-
-
Method Detail
-
getColor
public java.awt.Color getColor()
Returns the text color.- Returns:
- the text color
-
isPlain
public boolean isPlain()
Returnstrueif no font styles are enabled.- Returns:
- whether no font styles are enabled
-
isItalic
public boolean isItalic()
Returnstrueif italics is enabled.- Returns:
- the italics flag
-
isBold
public boolean isBold()
Returnstrueif 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 fontg- 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 modifiedfont- the font to add the styles to
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-