Class awt.Graphics
All Packages    This Package    Previous    Next

Class awt.Graphics

java.lang.Object
   |
   +----awt.GenericGraphics
           |
           +----awt.Graphics

public class Graphics
extends GenericGraphics
Graphics is an object that encapsulates a graphics context for a particular window. It will eventually be renamed "WSGraphics". For now, there is an empty "WSGraphics" subclass which is identical to this class.
Version:
1.6 23 Feb 1995
Author:
Sami Shaio

drawSurface
wServer

Graphics(Window, int, int, float, float)
Create a graphics context.
Graphics(Window)
Create a graphics context with origin at (0,0)
Graphics()

clearClip()
Clears the clipping region.
clearRect(int, int, int, int)
Clears the rectangle indicated by x,y,w,h.
clipRect(int, int, int, int)
Sets the clipping rectangle for this Graphics context.
copyArea(int, int, int, int, int, int)
Copies an area of the window that this graphics context paints to.
createChild(int, int, float, float)
Create a new Graphics Object based on this one.
dispose()
Disposes of this Graphics context.
drawBytes(byte[], int, int, int, int)
Draws the given byte array.
drawBytesWidth(byte[], int, int, int, int)
Draws the given character array and return the width in pixels.
drawChars(char[], int, int, int, int)
Draws the given character array.
drawCharsWidth(char[], int, int, int, int)
Draws the given character array and return the width in pixels.
drawImage(Image, int, int)
Draws an image at x,y.
drawLine(int, int, int, int)
Draws the given line.
drawRect(int, int, int, int)
Draws the given rectangle.
drawString(String, int, int)
Draws the given string.
drawStringWidth(String, int, int)
Draws the given string and returns the length of the drawn string in pixels.
fillRect(int, int, int, int)
Fills the given rectangle with the foreground color.
paint3DRect(int, int, int, int, boolean, boolean)
Paints a highlighted rectangle.
setBackground(Color)
Sets the background color.
setFont(Font)
Sets the font for all subsequent text-drawing operations.
setForeground(Color)
Sets the foreground color.
setOrigin(int, int)
Sets the origin of this Graphics context.
setScaling(float, float)
Sets the scaling factor for this Graphics context.

drawSurface
  public Window drawSurface
wServer
  public WServer wServer

Graphics
  public Graphics(Window w,
                  int oX,
                  int oY,
                  float sX,
                  float sY)
Create a graphics context.

Graphics

  public Graphics(Window w)
Create a graphics context with origin at (0,0)

Graphics

  protected Graphics()

createChild
  public Graphics createChild(int oX,
                              int oY,
                              float sX,
                              float sY)
Create a new Graphics Object based on this one.
Overrides:
createChild in class GenericGraphics

dispose

  public void dispose()
Disposes of this Graphics context. It can't be used after being disposed.
Overrides:
dispose in class GenericGraphics

setFont

  public void setFont(Font f)
Sets the font for all subsequent text-drawing operations.
Overrides:
setFont in class GenericGraphics

setForeground

  public void setForeground(Color c)
Sets the foreground color.
Overrides:
setForeground in class GenericGraphics

setBackground

  public void setBackground(Color c)
Sets the background color.
Overrides:
setBackground in class GenericGraphics

paint3DRect

  public void paint3DRect(int x,
                          int y,
                          int w,
                          int h,
                          boolean fill,
                          boolean raised)
Paints a highlighted rectangle.
Overrides:
paint3DRect in class GenericGraphics

clipRect

  public void clipRect(int X,
                       int Y,
                       int W,
                       int H)
Sets the clipping rectangle for this Graphics context.
Overrides:
clipRect in class GenericGraphics

clearClip

  public void clearClip()
Clears the clipping region.
Overrides:
clearClip in class GenericGraphics

clearRect

  public void clearRect(int X,
                        int Y,
                        int W,
                        int H)
Clears the rectangle indicated by x,y,w,h.
Overrides:
clearRect in class GenericGraphics

fillRect

  public void fillRect(int X,
                       int Y,
                       int W,
                       int H)
Fills the given rectangle with the foreground color.
Overrides:
fillRect in class GenericGraphics

drawRect

  public void drawRect(int X,
                       int Y,
                       int W,
                       int H)
Draws the given rectangle.
Overrides:
drawRect in class GenericGraphics

drawString

  public void drawString(String str,
                         int x,
                         int y)
Draws the given string.
Overrides:
drawString in class GenericGraphics

drawChars

  public void drawChars(char chars[],
                        int offset,
                        int length,
                        int x,
                        int y)
Draws the given character array.
Overrides:
drawChars in class GenericGraphics

drawBytes

  public void drawBytes(byte bytes[],
                        int offset,
                        int length,
                        int x,
                        int y)
Draws the given byte array.

drawStringWidth

  public int drawStringWidth(String str,
                             int x,
                             int y)
Draws the given string and returns the length of the drawn string in pixels. If font isn't set then returns -1.
Overrides:
drawStringWidth in class GenericGraphics

drawCharsWidth

  public int drawCharsWidth(char chars[],
                            int offset,
                            int length,
                            int x,
                            int y)
Draws the given character array and return the width in pixels. If font isn't set then returns -1.
Overrides:
drawCharsWidth in class GenericGraphics

drawBytesWidth

  public int drawBytesWidth(byte bytes[],
                            int offset,
                            int length,
                            int x,
                            int y)
Draws the given character array and return the width in pixels. If font isn't set then returns -1.

drawLine

  public void drawLine(int x1,
                       int y1,
                       int x2,
                       int y2)
Draws the given line.
Overrides:
drawLine in class GenericGraphics

drawImage

  public void drawImage(Image I,
                        int X,
                        int Y)
Draws an image at x,y.
Overrides:
drawImage in class GenericGraphics

copyArea

  public void copyArea(int X,
                       int Y,
                       int W,
                       int H,
                       int dx,
                       int dy)
Copies an area of the window that this graphics context paints to.
Parameters:
X - the x-coordinate of the source.
Y - the y-coordinate of the source.
W - the width.
H - the height.
dx - the x-coordinate of the destination.
dy - the y-coordinate of the destination.
Overrides:
copyArea in class GenericGraphics

setOrigin

  public void setOrigin(int x,
                        int y)
Sets the origin of this Graphics context. All subsequent operations are relative to this origin.
Overrides:
setOrigin in class GenericGraphics

setScaling

  public void setScaling(float sx,
                         float sy)
Sets the scaling factor for this Graphics context. Currently only used for line and rectangle drawing operations.
Overrides:
setScaling in class GenericGraphics


All Packages    This Package    Previous    Next