JIDE 3.5.15

com.jidesoft.editor
Class SyntaxStyle

java.lang.Object
  extended by com.jidesoft.editor.SyntaxStyle
All Implemented Interfaces:
ColorStyle, EffectStyle, FontStyle, Style

public class SyntaxStyle
extends Object
implements ColorStyle, FontStyle, EffectStyle

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

Field Summary
 
Fields inherited from interface com.jidesoft.editor.EffectStyle
EFFECT_BORDERED, EFFECT_NONE, EFFECT_STRIKE_THROUGH, EFFECT_UNDERLINE, EFFECT_WAVED
 
Constructor Summary
SyntaxStyle()
           
SyntaxStyle(Color background)
           
SyntaxStyle(Color background, Color foreground)
           
SyntaxStyle(Color background, Color foreground, Color stripeColor)
           
SyntaxStyle(Color foreground, int fontStyle)
          Creates a new SyntaxStyle.
SyntaxStyle(int effect, Color effectColor)
           
SyntaxStyle(int effect, Color effectColor, Color stripeColor)
           
 
Method Summary
 Color getBackground()
          Gets the background.
 int getEffect()
          Gets the effect.
 Color getEffectColor()
          Gets the effect color.
 FontMetrics getFontMetrics(Font font, Graphics g)
          Returns the font metrics for the styled font.
 int getFontStyle()
          Gets the font style.
 Color getForeground()
          Returns the color specified in this style.
 Color getStripeColor()
          Gets the stripe color.
 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 font style is not bold nor italic.
 void paintMarker(Graphics g, int x1, int x2, int y, FontMetrics fm)
           
 void setBackground(Color background)
          Sets the background.
 void setEffect(int effect)
          Sets the effect.
 void setEffectColor(Color effectColor)
          Sets the color of the effect.
 void setFontStyle(int fontStyle)
          Sets the font style.
 void setForeground(Color foreground)
          Sets the foreground.
 void setGraphicsFlags(Graphics gfx, Font font)
          Sets the foreground color and font of the specified graphics context to that specified in this style.
 void setStripeColor(Color stripeColor)
          Sets the stripe color.
 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()

SyntaxStyle

public SyntaxStyle(Color foreground,
                   int fontStyle)
Creates a new SyntaxStyle.

Parameters:
foreground - The text color
fontStyle - as defined in Font.

SyntaxStyle

public SyntaxStyle(int effect,
                   Color effectColor)

SyntaxStyle

public SyntaxStyle(int effect,
                   Color effectColor,
                   Color stripeColor)

SyntaxStyle

public SyntaxStyle(Color background)

SyntaxStyle

public SyntaxStyle(Color background,
                   Color foreground)

SyntaxStyle

public SyntaxStyle(Color background,
                   Color foreground,
                   Color stripeColor)
Method Detail

getForeground

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

Specified by:
getForeground in interface ColorStyle
Returns:
the foreground.

setForeground

public void setForeground(Color foreground)
Description copied from interface: ColorStyle
Sets the foreground.

Specified by:
setForeground in interface ColorStyle
Parameters:
foreground - the new foreground.

getFontStyle

public int getFontStyle()
Gets the font style.

Specified by:
getFontStyle in interface FontStyle
Returns:
the font style.

setFontStyle

public void setFontStyle(int fontStyle)
Sets the font style.

Specified by:
setFontStyle in interface FontStyle
Parameters:
fontStyle - the font style

isItalic

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

Returns:
true if italics is enabled for this style. Otherwise false.

isBold

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

Returns:
true if boldface is enabled for this style. Otherwise false.
See Also:
isPlain()

isPlain

public boolean isPlain()
Returns true if font style is not bold nor italic.

Returns:
true if font style is not bold nor italic. Otherwise false

getBackground

public Color getBackground()
Description copied from interface: ColorStyle
Gets the background.

Specified by:
getBackground in interface ColorStyle
Returns:
the background.

setBackground

public void setBackground(Color background)
Description copied from interface: ColorStyle
Sets the background.

Specified by:
setBackground in interface ColorStyle
Parameters:
background - the new background.

getEffectColor

public Color getEffectColor()
Description copied from interface: EffectStyle
Gets the effect color.

Specified by:
getEffectColor in interface EffectStyle
Returns:
the effect color.

setEffectColor

public void setEffectColor(Color effectColor)
Description copied from interface: EffectStyle
Sets the color of the effect. For example, if the effect is a underline, the color will be used to paint the line.

Specified by:
setEffectColor in interface EffectStyle
Parameters:
effectColor - the new effect color.

getEffect

public int getEffect()
Description copied from interface: EffectStyle
Gets the effect.

Specified by:
getEffect in interface EffectStyle
Returns:
the effect.

setEffect

public void setEffect(int effect)
Description copied from interface: EffectStyle
Sets the effect.

Specified by:
setEffect in interface EffectStyle
Parameters:
effect - the new effect.

getStripeColor

public Color getStripeColor()
Description copied from interface: EffectStyle
Gets the stripe color.

Specified by:
getStripeColor in interface EffectStyle
Returns:
the stripe color.

setStripeColor

public void setStripeColor(Color stripeColor)
Description copied from interface: EffectStyle
Sets the stripe color. When a text has a special effect, you might also want to show a color stripe on the marker stripe area. This is the color that will be used.

Specified by:
setStripeColor in interface EffectStyle
Parameters:
stripeColor - the new stripe color. Null if you don't want to show any stripe for this effect.

getStyledFont

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

Parameters:
font - the current font
Returns:
the specified font, but with the style's bold and italic flags applied.

getFontMetrics

public FontMetrics getFontMetrics(Font font,
                                  Graphics g)
Returns the font metrics for the styled font.

Parameters:
font - the font
g - the graphics
Returns:
the font metrics for the specified 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

paintMarker

public void paintMarker(Graphics g,
                        int x1,
                        int x2,
                        int y,
                        FontMetrics fm)

JIDE 3.5.15