UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.satin.graphics
Class SatinGraphics

java.lang.Object
  |
  +--java.awt.Graphics
        |
        +--java.awt.Graphics2D
              |
              +--edu.berkeley.guir.lib.satin.graphics.SatinGraphics
All Implemented Interfaces:
GraphicsConstants

public class SatinGraphics
extends Graphics2D
implements GraphicsConstants

The Satin Graphics context, an extension of Graphics2D. Has some additional capabilities, such as drawing with Styles, and a stack of Transforms.

This software is distributed under the Berkeley Software License.

 Revisions:  - SATIN-v1.0-1.0.0, Apr 15 1999, JH
               Created class
             - SATIN-v2.1-1.0.0, Aug 11 2000, JH
               Touched for SATIN release
 

Since:
JDK 1.2
Version:
SATIN-v2.1-1.0.0, Aug 11 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu )

Fields inherited from interface edu.berkeley.guir.lib.satin.graphics.GraphicsConstants
BOTTOM, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER, HIGH_QUALITY, HIGHEST_QUALITY, LEFT, LOW_QUALITY, LOWEST_QUALITY, MEDIUM_QUALITY, RIGHT, TOP, TOP_LEFT, TOP_RIGHT
 
Constructor Summary
SatinGraphics()
          Be sure the call setGraphics() before using.
SatinGraphics(Graphics2D newG)
          Create a wrapper around the specified Graphics2D object.
 
Method Summary
 void addRenderingHints(Map hints)
           
static Point calculateNewPosition(Shape shape, int pos)
          Shift an object to have new coordinates.
static Point calculateTranslation(Shape shape, int x, int y, int pos)
          Calculate how much a Shape should be translated along x- and y- such that the specified position of the Shape will be at the specified (x,y) coordinate.
 void clearAllTransforms()
          Clear out all transforms.
 void clearRect(int x, int y, int width, int height)
           
 void clip(Shape s)
           
 void clipRect(int x, int y, int width, int height)
           
 void copyArea(int x, int y, int width, int height, int dx, int dy)
           
 Graphics create()
           
 Graphics create(int x, int y, int width, int height)
           
 void dispose()
           
 void dontIgnoreTransforms()
          Restore the current transforms.
 void draw(Shape s)
           
 void draw3DRect(int x, int y, int width, int height, boolean raised)
           
 void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
           
 void drawBytes(byte[] data, int offset, int length, int x, int y)
           
 void drawChars(char[] data, int offset, int length, int x, int y)
           
 void drawGlyphVector(GlyphVector gv, float x, float y)
           
 void drawImage(BufferedImage img, BufferedImageOp op, int x, int y)
          Transparency not implemented for this method yet.
 boolean drawImage(Image img, AffineTransform xform, ImageObserver obs)
           
 boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
           
 boolean drawImage(Image img, int x, int y, ImageObserver observer)
           
 boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
           
 boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
           
 boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
           
 boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
           
 void drawLine(int x1, int y1, int x2, int y2)
           
 void drawOval(int x, int y, int width, int height)
           
 void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
           
 void drawPolygon(Polygon p)
           
 void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
           
 void drawRect(int x, int y, int width, int height)
           
 void drawRect(int x, int y, int width, int height, int pos)
           
 void drawRect(Rectangle rect)
          This is a convenience method, since Java doesn't let you just draw Rectangles.
 void drawRect(Rectangle rect, int pos)
          Draw a Rectangle, and qualify what the coordinates are supposed to be.
 void drawRenderableImage(RenderableImage img, AffineTransform xform)
           
 void drawRenderedImage(RenderedImage img, AffineTransform xform)
           
 void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
           
 void drawString(AttributedCharacterIterator iterator, float x, float y)
           
 void drawString(AttributedCharacterIterator iterator, int x, int y)
           
 void drawString(String s, float x, float y)
           
 void drawString(String str, int x, int y)
           
 void drawString(String str, int x, int y, int pos)
          Draw a String at the specified coordinates, and qualifying what the coordinates are supposed to be.
 void fill(Shape s)
           
 void fill3DRect(int x, int y, int width, int height, boolean raised)
           
 void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
           
 void fillOval(int x, int y, int width, int height)
           
 void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
           
 void fillPolygon(Polygon p)
           
 void fillRect(int x, int y, int width, int height)
           
 void fillRect(int x, int y, int width, int height, int pos)
          Fills the Rectangle.
 void fillRect(Rectangle rect, int pos)
          Fills the Rectangle.
 void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
           
 void finalize()
           
 Color getBackground()
           
 Shape getClip()
           
 Rectangle getClipBounds()
           
 Rectangle getClipBounds(Rectangle r)
           
 Rectangle getClipRect()
           
 Color getColor()
           
 Composite getComposite()
           
 GraphicsConfiguration getDeviceConfiguration()
           
 Font getFont()
           
 FontMetrics getFontMetrics()
           
 FontMetrics getFontMetrics(Font f)
           
 FontRenderContext getFontRenderContext()
           
 Graphics2D getGraphics()
          Get the current Graphics context.
 Point getOrigin()
          Get where the current origin is.
 Paint getPaint()
           
 Object getRenderingHint(RenderingHints.Key hintKey)
           
 RenderingHints getRenderingHints()
           
 Stroke getStroke()
           
 Style getStyle()
          Get the current drawing Style.
 AffineTransform getTransform()
           
 float getTransparency()
          Get the current transparency value.
 boolean hit(Rectangle rect, Shape s, boolean onStroke)
           
 boolean hitClip(int x, int y, int width, int height)
           
 void ignoreTransforms()
          Temporarily ignore the current transform, restoring it to the default transform.
 void popOrigin()
          Go back to the previous origin coordinates.
 void popStyle()
          Pop a Style off the Stack, restoring the previous Style.
 void popTransform()
          Undo the last transform.
 void pushOrigin(int x, int y)
          Specify where the origin of the graphics should be relative to.
 void pushOrigin(Point pt)
          Specify where the origin of the graphics should be relative to.
 void pushStyle(Style s)
          Push a new Style onto the Stack for this Graphics to use.
 void pushTransform(AffineTransform tx)
          Apply a new transform to this SatinGraphics context.
 void rotate(double theta)
          Applies the specified transformation.
 void rotate(double theta, double x, double y)
          Applies the specified transformation.
 void scale(double sx, double sy)
          Applies the specified transformation.
 void setBackground(Color color)
           
 void setClip(int x, int y, int width, int height)
           
 void setClip(Shape clip)
           
 void setColor(Color c)
          Sets the current style to use the specified Color.
 void setComposite(Composite comp)
           
 void setDefaultTransform(AffineTransform tx)
          Set the transform that will be used when ignoreTransforms() is called.
 void setFont(Font font)
          Sets the current style to use the specified Color.
 void setGraphics(Graphics2D newG)
          Set the graphics context to draw with.
 void setPaint(Paint paint)
           
 void setPaintMode()
           
 void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
           
 void setRenderingHints(Map hints)
           
 void setRenderQuality(int value)
          Set the quality / speed level of rendering.
 void setStroke(Stroke s)
          Sets the current style to use the specified Stroke.
 void setTransform(AffineTransform Tx)
          Sets the current transform to the specified AffineTransform.
 void setTransparency(float val)
          Set the overall transparency of all things drawn in this Graphics context.
 void setXORMode(Color c1)
           
 void shear(double shx, double shy)
          Applies the specified transformation.
 String toString()
           
 void transform(AffineTransform Tx)
          Applies the specified transformation.
 void translate(double tx, double ty)
          Applies the specified transformation.
 void translate(int x, int y)
          Applies the specified transformation.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SatinGraphics

public SatinGraphics()
Be sure the call setGraphics() before using.

SatinGraphics

public SatinGraphics(Graphics2D newG)
Create a wrapper around the specified Graphics2D object.
Parameters:
newG - is the Graphics2D object we will delegate to.
Method Detail

setRenderQuality

public final void setRenderQuality(int value)
Set the quality / speed level of rendering. Be sure to call this BEFORE calling setGraphics(Graphics2D). Use one of the following values as the parameter for quality:

setGraphics

public final void setGraphics(Graphics2D newG)
Set the graphics context to draw with.
Parameters:
newG - is the graphics context to set to.

getGraphics

public final Graphics2D getGraphics()
Get the current Graphics context.
Returns:
the current Graphics context.

pushStyle

public final void pushStyle(Style s)
Push a new Style onto the Stack for this Graphics to use.
Parameters:
s - is the Style to use.
See Also:
getStyle(), popStyle()

popStyle

public final void popStyle()
Pop a Style off the Stack, restoring the previous Style.
See Also:
getStyle(), pushStyle(edu.berkeley.guir.lib.satin.objects.Style)

getStyle

public final Style getStyle()
Get the current drawing Style. This is a copy, not a reference to the original.
Returns:
the Style that this SatinGraphics context will draw with.
See Also:
popStyle(), pushStyle(Style)

setTransparency

public final void setTransparency(float val)
Set the overall transparency of all things drawn in this Graphics context.
Parameters:
val - is a value between 0 and 1, 0 meaning fully transparent and 1 meaning fully solid.

getTransparency

public final float getTransparency()
Get the current transparency value.

pushOrigin

public final void pushOrigin(int x,
                             int y)
Specify where the origin of the graphics should be relative to. What it really does is create an AffineTransform that represents a translation, and just calls pushTransform().
Parameters:
x - is the origin's new x-position.
y - is the origin's new y-position.
See Also:
getOrigin(), popOrigin(), pushTransform(java.awt.geom.AffineTransform)

pushOrigin

public final void pushOrigin(Point pt)
Specify where the origin of the graphics should be relative to. This is cascaded with all of the previous pushOrigin() values.
Parameters:
pt - is the new origin.
See Also:
getOrigin(), popOrigin(), pushOrigin(int, int)

popOrigin

public final void popOrigin()
Go back to the previous origin coordinates.
See Also:
getOrigin(), pushOrigin(java.awt.Point), pushOrigin(int, int)

getOrigin

public final Point getOrigin()
Get where the current origin is. This is a copy, not a reference to anything important.
Returns:
a Point representing the coordinates of the current origin.
See Also:
popOrigin(), pushOrigin(java.awt.Point), pushOrigin(int, int)

clearAllTransforms

public final void clearAllTransforms()
Clear out all transforms.

setDefaultTransform

public final void setDefaultTransform(AffineTransform tx)
Set the transform that will be used when ignoreTransforms() is called. This needs to be called every time the Sheet gets a new Graphics context, because each Graphics context has its own default transform. Right now, this is automatically called every time setGraphics() is called.

ignoreTransforms

public final void ignoreTransforms()
Temporarily ignore the current transform, restoring it to the default transform. Additional transforms can be used once this method is called, but they will all be thrown away once dontIgnoreTransforms() is called.

This method is useful for Sticky views, like StickyViewWrapper and StickyZViewWrapper.

Be sure to call dontIgnoreTransforms() before you push or pop any transforms from the stack. Really bad things [tm] will happen if you don't.


dontIgnoreTransforms

public final void dontIgnoreTransforms()
Restore the current transforms. Do not call this unless ignoreTransforms() has been called earlier.

pushTransform

public final void pushTransform(AffineTransform tx)
Apply a new transform to this SatinGraphics context.
Parameters:
tx - is the AffineTransform to apply.
See Also:
popTransform()

popTransform

public final void popTransform()
Undo the last transform.
See Also:
pushTransform(java.awt.geom.AffineTransform)

calculateNewPosition

public static Point calculateNewPosition(Shape shape,
                                         int pos)
Shift an object to have new coordinates. For example, most objects are drawn using the specified (x,y) coordinates as the top-left corner. Let's say you want to use the specified (x,y) coordinates as the center. This method does this transformation, returning an (x,y) coordinate that says where you should draw.

Suppose you have a Rectangle, and you want to draw it such that it is centered at (0,0). Just call calculateNewPosition(rect, SatinGraphics.CENTER) to figure out where the top-left corner of the Rectangle should be drawn. Pretty neat, eh?

Parameters:
shape - is some shape to draw.
pos - specifies where to shift the drawing to (GraphicsConstants.CENTER, GraphicsConstants.TOP_LEFT, etc).
Returns:
a Point containing where to draw the object's top-left corner.

calculateTranslation

public static Point calculateTranslation(Shape shape,
                                         int x,
                                         int y,
                                         int pos)
Calculate how much a Shape should be translated along x- and y- such that the specified position of the Shape will be at the specified (x,y) coordinate.

For example, say you already have a circle, and want to draw this circle with (0,0) as its center. Just call calculateTranslation(circle, 0, 0, CENTER) to figure out how much the shape should be translated.

Parameters:
shape - is the Shape to determine how much to move. Make sure that the coordinates of shape are in the same coordinate system as x and y below.
x - is the x-coordinate to move it to.
y - is the y-coordinate to move it to.
pos - is the position that x and y represent (GraphicsConstants.CENTER, GraphicsConstants.TOP_LEFT, etc).
Returns:
a Point containing the amount to translate along x and y.

drawString

public void drawString(String str,
                       int x,
                       int y,
                       int pos)
Draw a String at the specified coordinates, and qualifying what the coordinates are supposed to be.

For example, if you want to draw a String with its top-right corner at position (100,200), just call drawString(str, 100, 200, SatinGraphics.TOP_RIGHT).

Parameters:
x - is the x-coordinate of where to draw.
y - is the y-coordinate of where to draw (it actually does not matter that y is usually the bottom and not the top coordinate, since we are specifying where to draw anyway).
pos - specifies what (x,y) are relative to the bounding box (GraphicsConstants.CENTER, GraphicsConstants.TOP_LEFT, etc).

drawRect

public void drawRect(Rectangle rect)
This is a convenience method, since Java doesn't let you just draw Rectangles. Pretty silly, right?

drawRect

public void drawRect(Rectangle rect,
                     int pos)
Draw a Rectangle, and qualify what the coordinates are supposed to be.

For example, let's suppose you have a Rectangle. You can draw this Rectangle normally. However, this method lets you shift it around a little. If you specify position BOTTOM_RIGHT, then the Rectangle is translated such that it's bottom-right corner is now where it's top-left corner used to be. Basically, any position you specify will translate the Rectangle such that the position will be translated to where the top-left corner is.

Parameters:
rect - is the Rectangle to draw.
pos - specifies what (x,y) are relative to the bounding box (GraphicsConstants.CENTER, GraphicsConstants.TOP_LEFT, etc).

drawRect

public void drawRect(int x,
                     int y,
                     int width,
                     int height,
                     int pos)
Parameters:
x - is the left side of the rectangle.
y - is the top of the rectangle.
width - is the width of the rectangle to draw.
height - is the height of the rectangle to draw.
pos - specifies what (x,y) are relative to the bounding box (GraphicsConstants.CENTER, GraphicsConstants.TOP_LEFT, etc).
See Also:
drawRect(java.awt.Rectangle, int)

fillRect

public void fillRect(Rectangle rect,
                     int pos)
Fills the Rectangle.
Parameters:
rect - is the Rectangle to draw.
pos - specifies what (x,y) are relative to the bounding box (GraphicsConstants.CENTER, GraphicsConstants.TOP_LEFT, etc).
See Also:
drawRect(java.awt.Rectangle, int)

fillRect

public void fillRect(int x,
                     int y,
                     int width,
                     int height,
                     int pos)
Fills the Rectangle.
Parameters:
x - is the left side of the rectangle.
y - is the top of the rectangle.
width - is the width of the rectangle to draw.
height - is the height of the rectangle to draw.
pos - specifies what (x,y) are relative to the bounding box (GraphicsConstants.CENTER, GraphicsConstants.TOP_LEFT, etc).
See Also:
drawRect(java.awt.Rectangle, int)

dispose

public final void dispose()
Overrides:
dispose in class Graphics

finalize

public final void finalize()
Overrides:
finalize in class Graphics

hitClip

public boolean hitClip(int x,
                       int y,
                       int width,
                       int height)
Overrides:
hitClip in class Graphics

create

public Graphics create()
Overrides:
create in class Graphics

create

public Graphics create(int x,
                       int y,
                       int width,
                       int height)
Overrides:
create in class Graphics

copyArea

public final void copyArea(int x,
                           int y,
                           int width,
                           int height,
                           int dx,
                           int dy)
Overrides:
copyArea in class Graphics

addRenderingHints

public final void addRenderingHints(Map hints)
Overrides:
addRenderingHints in class Graphics2D
See Also:
Graphics2D.addRenderingHints(java.util.Map)

setColor

public final void setColor(Color c)
Sets the current style to use the specified Color. You should note that this color will automatically be popped off the stack when the current GraphicalObject is done drawing.

Also automatically applies transparency.

Overrides:
setColor in class Graphics

setFont

public final void setFont(Font font)
Sets the current style to use the specified Color. You should note that this Font will automatically be popped off the stack when the current GraphicalObject is done drawing.
Overrides:
setFont in class Graphics

setPaintMode

public final void setPaintMode()
Overrides:
setPaintMode in class Graphics

setXORMode

public final void setXORMode(Color c1)
Overrides:
setXORMode in class Graphics

setClip

public final void setClip(int x,
                          int y,
                          int width,
                          int height)
Overrides:
setClip in class Graphics

setClip

public final void setClip(Shape clip)
Overrides:
setClip in class Graphics

clipRect

public final void clipRect(int x,
                           int y,
                           int width,
                           int height)
Overrides:
clipRect in class Graphics

getColor

public Color getColor()
Overrides:
getColor in class Graphics

getFont

public Font getFont()
Overrides:
getFont in class Graphics

getFontMetrics

public FontMetrics getFontMetrics()
Overrides:
getFontMetrics in class Graphics

getFontMetrics

public FontMetrics getFontMetrics(Font f)
Overrides:
getFontMetrics in class Graphics

getClipBounds

public Rectangle getClipBounds()
Overrides:
getClipBounds in class Graphics

getClip

public Shape getClip()
Overrides:
getClip in class Graphics

getClipRect

public Rectangle getClipRect()
Overrides:
getClipRect in class Graphics

getClipBounds

public Rectangle getClipBounds(Rectangle r)
Overrides:
getClipBounds in class Graphics

drawLine

public final void drawLine(int x1,
                           int y1,
                           int x2,
                           int y2)
Overrides:
drawLine in class Graphics

fillRect

public final void fillRect(int x,
                           int y,
                           int width,
                           int height)
Overrides:
fillRect in class Graphics

drawRect

public final void drawRect(int x,
                           int y,
                           int width,
                           int height)
Overrides:
drawRect in class Graphics

clearRect

public final void clearRect(int x,
                            int y,
                            int width,
                            int height)
Overrides:
clearRect in class Graphics

drawRoundRect

public final void drawRoundRect(int x,
                                int y,
                                int width,
                                int height,
                                int arcWidth,
                                int arcHeight)
Overrides:
drawRoundRect in class Graphics

fillRoundRect

public final void fillRoundRect(int x,
                                int y,
                                int width,
                                int height,
                                int arcWidth,
                                int arcHeight)
Overrides:
fillRoundRect in class Graphics

drawOval

public final void drawOval(int x,
                           int y,
                           int width,
                           int height)
Overrides:
drawOval in class Graphics

fillOval

public final void fillOval(int x,
                           int y,
                           int width,
                           int height)
Overrides:
fillOval in class Graphics

drawArc

public final void drawArc(int x,
                          int y,
                          int width,
                          int height,
                          int startAngle,
                          int arcAngle)
Overrides:
drawArc in class Graphics

fillArc

public final void fillArc(int x,
                          int y,
                          int width,
                          int height,
                          int startAngle,
                          int arcAngle)
Overrides:
fillArc in class Graphics

drawPolyline

public final void drawPolyline(int[] xPoints,
                               int[] yPoints,
                               int nPoints)
Overrides:
drawPolyline in class Graphics

drawPolygon

public final void drawPolygon(int[] xPoints,
                              int[] yPoints,
                              int nPoints)
Overrides:
drawPolygon in class Graphics

drawPolygon

public final void drawPolygon(Polygon p)
Overrides:
drawPolygon in class Graphics

fillPolygon

public final void fillPolygon(int[] xPoints,
                              int[] yPoints,
                              int nPoints)
Overrides:
fillPolygon in class Graphics

fillPolygon

public final void fillPolygon(Polygon p)
Overrides:
fillPolygon in class Graphics

drawString

public final void drawString(String str,
                             int x,
                             int y)
Overrides:
drawString in class Graphics2D

drawChars

public final void drawChars(char[] data,
                            int offset,
                            int length,
                            int x,
                            int y)
Overrides:
drawChars in class Graphics

drawBytes

public final void drawBytes(byte[] data,
                            int offset,
                            int length,
                            int x,
                            int y)
Overrides:
drawBytes in class Graphics

drawImage

public boolean drawImage(Image img,
                         int x,
                         int y,
                         ImageObserver observer)
Overrides:
drawImage in class Graphics

drawImage

public boolean drawImage(Image img,
                         int x,
                         int y,
                         int width,
                         int height,
                         ImageObserver observer)
Overrides:
drawImage in class Graphics

drawImage

public boolean drawImage(Image img,
                         int x,
                         int y,
                         Color bgcolor,
                         ImageObserver observer)
Overrides:
drawImage in class Graphics

drawImage

public boolean drawImage(Image img,
                         int x,
                         int y,
                         int width,
                         int height,
                         Color bgcolor,
                         ImageObserver observer)
Overrides:
drawImage in class Graphics

drawImage

public boolean drawImage(Image img,
                         int dx1,
                         int dy1,
                         int dx2,
                         int dy2,
                         int sx1,
                         int sy1,
                         int sx2,
                         int sy2,
                         ImageObserver observer)
Overrides:
drawImage in class Graphics

drawImage

public boolean drawImage(Image img,
                         int dx1,
                         int dy1,
                         int dx2,
                         int dy2,
                         int sx1,
                         int sy1,
                         int sx2,
                         int sy2,
                         Color bgcolor,
                         ImageObserver observer)
Overrides:
drawImage in class Graphics

getFontRenderContext

public FontRenderContext getFontRenderContext()
Overrides:
getFontRenderContext in class Graphics2D

hit

public boolean hit(Rectangle rect,
                   Shape s,
                   boolean onStroke)
Overrides:
hit in class Graphics2D

getDeviceConfiguration

public GraphicsConfiguration getDeviceConfiguration()
Overrides:
getDeviceConfiguration in class Graphics2D

setRenderingHint

public final void setRenderingHint(RenderingHints.Key hintKey,
                                   Object hintValue)
Overrides:
setRenderingHint in class Graphics2D

getRenderingHint

public Object getRenderingHint(RenderingHints.Key hintKey)
Overrides:
getRenderingHint in class Graphics2D

setRenderingHints

public final void setRenderingHints(Map hints)
Overrides:
setRenderingHints in class Graphics2D

getRenderingHints

public RenderingHints getRenderingHints()
Overrides:
getRenderingHints in class Graphics2D

getBackground

public Color getBackground()
Overrides:
getBackground in class Graphics2D

getStroke

public Stroke getStroke()
Overrides:
getStroke in class Graphics2D

getTransform

public AffineTransform getTransform()
Overrides:
getTransform in class Graphics2D

getPaint

public Paint getPaint()
Overrides:
getPaint in class Graphics2D

getComposite

public Composite getComposite()
Overrides:
getComposite in class Graphics2D

setStroke

public final void setStroke(Stroke s)
Sets the current style to use the specified Stroke. You should note that this Stroke will automatically be popped off the stack when the current GraphicalObject is done drawing.
Overrides:
setStroke in class Graphics2D
Parameters:
s - is a BasicStroke, not a Stroke (which is rather useless as currently defined).
Throws:
ClassCastException - if s is not a BasicStroke.

setTransform

public final void setTransform(AffineTransform Tx)
Sets the current transform to the specified AffineTransform. You should note that this AffineTransform will automatically be popped off the stack when the current GraphicalObject is done drawing.

Please note that it is inherently dangerous to call this unless you know the original AffineTransform that came with this graphics context, as well as the AffineTransform to convert between virtual and screen coordinates (We save this value in txDefaultTransform, but don't mess around with it unless you have to).

Instead of calling this method, you probably want to use transform(AffineTransform) instead, which just applies a transform to the current transform.

Overrides:
setTransform in class Graphics2D

translate

public final void translate(int x,
                            int y)
Applies the specified transformation. You should note that the resulting AffineTransform will automatically be popped off the stack when the current GraphicalObject is done drawing.
Overrides:
translate in class Graphics2D

translate

public final void translate(double tx,
                            double ty)
Applies the specified transformation. You should note that the resulting AffineTransform will automatically be popped off the stack when the current GraphicalObject is done drawing.
Overrides:
translate in class Graphics2D

rotate

public final void rotate(double theta)
Applies the specified transformation. You should note that the resulting AffineTransform will automatically be popped off the stack when the current GraphicalObject is done drawing.
Overrides:
rotate in class Graphics2D

rotate

public final void rotate(double theta,
                         double x,
                         double y)
Applies the specified transformation. You should note that the resulting AffineTransform will automatically be popped off the stack when the current GraphicalObject is done drawing.
Overrides:
rotate in class Graphics2D

scale

public final void scale(double sx,
                        double sy)
Applies the specified transformation. You should note that the resulting AffineTransform will automatically be popped off the stack when the current GraphicalObject is done drawing.
Overrides:
scale in class Graphics2D

shear

public final void shear(double shx,
                        double shy)
Applies the specified transformation. You should note that the resulting AffineTransform will automatically be popped off the stack when the current GraphicalObject is done drawing.
Overrides:
shear in class Graphics2D

transform

public final void transform(AffineTransform Tx)
Applies the specified transformation. You should note that the resulting AffineTransform will automatically be popped off the stack when the current GraphicalObject is done drawing.
Overrides:
transform in class Graphics2D

clip

public final void clip(Shape s)
Overrides:
clip in class Graphics2D

setComposite

public final void setComposite(Composite comp)
Overrides:
setComposite in class Graphics2D

setPaint

public final void setPaint(Paint paint)
Overrides:
setPaint in class Graphics2D

setBackground

public final void setBackground(Color color)
Overrides:
setBackground in class Graphics2D

draw

public final void draw(Shape s)
Overrides:
draw in class Graphics2D

draw3DRect

public final void draw3DRect(int x,
                             int y,
                             int width,
                             int height,
                             boolean raised)
Overrides:
draw3DRect in class Graphics2D

drawGlyphVector

public final void drawGlyphVector(GlyphVector gv,
                                  float x,
                                  float y)
Overrides:
drawGlyphVector in class Graphics2D

fill3DRect

public final void fill3DRect(int x,
                             int y,
                             int width,
                             int height,
                             boolean raised)
Overrides:
fill3DRect in class Graphics2D

drawImage

public boolean drawImage(Image img,
                         AffineTransform xform,
                         ImageObserver obs)
Overrides:
drawImage in class Graphics2D

drawImage

public final void drawImage(BufferedImage img,
                            BufferedImageOp op,
                            int x,
                            int y)
Transparency not implemented for this method yet.
Overrides:
drawImage in class Graphics2D

drawRenderedImage

public final void drawRenderedImage(RenderedImage img,
                                    AffineTransform xform)
Overrides:
drawRenderedImage in class Graphics2D

drawRenderableImage

public final void drawRenderableImage(RenderableImage img,
                                      AffineTransform xform)
Overrides:
drawRenderableImage in class Graphics2D

drawString

public final void drawString(String s,
                             float x,
                             float y)
Overrides:
drawString in class Graphics2D

drawString

public final void drawString(AttributedCharacterIterator iterator,
                             int x,
                             int y)
Overrides:
drawString in class Graphics2D

drawString

public final void drawString(AttributedCharacterIterator iterator,
                             float x,
                             float y)
Overrides:
drawString in class Graphics2D

fill

public final void fill(Shape s)
Overrides:
fill in class Graphics2D

toString

public String toString()
Overrides:
toString in class Graphics

Copyright Information