http://www.eteks.com

com.eteks.awt
Interface PJAGraphicsExtension

All Known Implementing Classes:
PJAGraphics

public interface PJAGraphicsExtension

Pure Java AWT Graphics extension. This interface lists extension methods implemented by Graphics classes. This methods may be usefull for graphics operation when security manager is restrictive.

Since:
PJA1.1
Version:
2.1
Author:
Emmanuel Puybaret
See Also:
PJAGraphicsManager, PJAGraphics, Graphics

Method Summary
 int getCharWidth(char ch)
          Returns the advance width of the specified character of the current font.
 int getColorRGB()
          Returns the graphics current color.
 int getFontAscent()
          Determines the font ascent of the current font.
 int getFontDescent()
          Determines the font descent of the current font.
 int getFontLeading()
          Determines the standard leading of the current font.
 int getFontMaxAdvance()
          Gets the maximum advance width of any character of the current Font.
 int getFontMaxAscent()
          Determines the maximum ascent of the current font.
 int getFontMaxDescent()
          Determines the maximum descent of the current font.
 java.lang.String getFontName()
          Returns the graphics current font name.
 int getFontSize()
          Returns the graphics current font size.
 int getFontStyle()
          Returns the graphics current font style.
 int getStringWidth(java.lang.String str)
          Returns the total advance width for showing the specified String of the current Font.
 void setColor(int red, int green, int blue)
          Sets the graphics context's color.
 void setFont(java.lang.String fontName, int fontStyle, int fontSize)
          Sets the graphics font to the specified font specified by its name, style and size.
 void setXORMode(int red, int green, int blue)
          Sets this graphics context's XOR color.
 

Method Detail

setFont

public void setFont(java.lang.String fontName,
                    int fontStyle,
                    int fontSize)
Sets the graphics font to the specified font specified by its name, style and size. It has the same effect as setFont (Font) of Graphics class, but doesn't need to instantiate a Font object.
Parameters:
fontName - the font name.
fontStyle - the font style.
fontSize - the font size.
Since:
PJA1.1
See Also:
Graphics.setFont(Font)

getFontName

public java.lang.String getFontName()
Returns the graphics current font name. It has the same effect as getFont ().getName () call with a Graphics instance, but doesn't need to instantiate a Font object.
Returns:
the font name.
Since:
PJA1.1
See Also:
Graphics.getFont()

getFontStyle

public int getFontStyle()
Returns the graphics current font style. It has the same effect as getFont ().getStyle () call with a Graphics instance, but doesn't need to instantiate a Font object.
Returns:
the font style.
Since:
PJA1.1
See Also:
Graphics.getFont()

getFontSize

public int getFontSize()
Returns the graphics current font size. It has the same effect as getFont ().getSize () call with a Graphics instance, but doesn't need to instantiate a Font object.
Returns:
the font size.
Since:
PJA1.1
See Also:
Graphics.getFont()

setColor

public void setColor(int red,
                     int green,
                     int blue)
Sets the graphics context's color. It has the same effect as setColor (Color) of Graphics class, but doesn't need to instantiate a Font object.
Parameters:
red - the red component.
green - the green component.
blue - the blue component.
Since:
PJA1.1
See Also:
PJAGraphicsExtension

getColorRGB

public int getColorRGB()
Returns the graphics current color. It has the same effect as getColor ().getRGB () call with a Graphics instance, but doesn't need to instantiate a Color object.
Returns:
the color RGB.
Since:
PJA1.1
See Also:
Graphics.getFont()

setXORMode

public void setXORMode(int red,
                       int green,
                       int blue)
Sets this graphics context's XOR color. It has the same effect as setXORMode (Color) of Graphics class, but doesn't need to instantiate a Font object.
Parameters:
red - the red component.
green - the green component.
blue - the blue component.
Since:
PJA1.1
See Also:
PJAGraphicsExtension

getFontLeading

public int getFontLeading()
Determines the standard leading of the current font. The standard leading (interline spacing) is the logical amount of space to be reserved between the descent of one line of text and the ascent of the next line. The height metric is calculated to include this extra space. It has the same effect as getFontMetrics ().getLeading () call with a Graphics instance, but doesn't need to instantiate a FontMetrics object.
Returns:
the standard leading of the current font.
Since:
PJA1.1
See Also:
FontMetrics.getLeading()

getFontAscent

public int getFontAscent()
Determines the font ascent of the current font. The font ascent is the distance from the font's baseline to the top of most alphanumeric characters. Some characters in the font may extend above the font ascent line. It has the same effect as getFontMetrics ().getAscent () call with a Graphics instance, but doesn't need to instantiate a FontMetrics object.
Returns:
the font ascent of the font.
Since:
PJA1.1
See Also:
FontMetrics.getAscent()

getFontDescent

public int getFontDescent()
Determines the font descent of the current font. The font descent is the distance from the font's baseline to the bottom of most alphanumeric characters with descenders. Some characters in the font may extend below the font descent line. It has the same effect as getFontMetrics ().getDescent () call with a Graphics instance, but doesn't need to instantiate a FontMetrics object.
Returns:
the font descent of the font.
Since:
PJA1.1
See Also:
FontMetrics.getDescent()

getFontMaxAscent

public int getFontMaxAscent()
Determines the maximum ascent of the current font. No character extends further above the font's baseline than this height. It has the same effect as getFontMetrics ().getMaxAscent () call with a Graphics instance, but doesn't need to instantiate a FontMetrics object.
Returns:
the maximum ascent of any character in the font.
Since:
PJA1.1
See Also:
FontMetrics.getMaxAscent()

getFontMaxDescent

public int getFontMaxDescent()
Determines the maximum descent of the current font. No character extends further below the font's baseline than this height. It has the same effect as getFontMetrics ().getMaxDescent () call with a Graphics instance, but doesn't need to instantiate a FontMetrics object.
Returns:
the maximum descent of any character in the font.
Since:
PJA1.1
See Also:
FontMetrics.getMaxDescent()

getFontMaxAdvance

public int getFontMaxAdvance()
Gets the maximum advance width of any character of the current Font. The advance width is the amount by which the current point is moved from one character to the next in a line of text. It has the same effect as getFontMetrics ().getMaxAdvance () call with a Graphics instance, but doesn't need to instantiate a FontMetrics object.
Returns:
the maximum advance width of any character in the font.
Since:
PJA1.1
See Also:
FontMetrics.getMaxAdvance()

getCharWidth

public int getCharWidth(char ch)
Returns the advance width of the specified character of the current font. The advance width is the amount by which the current point is moved from one character to the next in a line of text. It has the same effect as getFontMetrics ().charWidth (ch) call with a Graphics instance, but doesn't need to instantiate a FontMetrics object.
Parameters:
ch - the character to be measured
Returns:
the advance width of the specified char in the font described by this font metric.
Since:
PJA1.1
See Also:
FontMetrics.charWidth(int)

getStringWidth

public int getStringWidth(java.lang.String str)
Returns the total advance width for showing the specified String of the current Font. The advance width is the amount by which the current point is moved from one character to the next in a line of text. It has the same effect as getFontMetrics ().stringWidth (str) call with a Graphics instance, but doesn't need to instantiate a FontMetrics object.
Parameters:
str - the String to be measured
Returns:
the advance width of the specified string in the font described by this font metric.
Since:
PJA1.1
See Also:
FontMetrics.stringWidth(java.lang.String)

© 1997-2001 eTeks - All rights reserved