Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.awt.Graphics
java.awt.Graphics2D
public abstract class Graphics2D
extends Graphics
JComponent
- in the
JComponent.paint(Graphics)
method, the incoming
Graphics
should always be an instance of
Graphics2D
;BufferedImage
- see
BufferedImage.createGraphics()
;PrinterJob
- in the
Printable.print(Graphics,PageFormat,int)
method, the incoming
Graphics
should always be an instance of
Graphics2D
.Third party libraries provide support for output to other formats via this API, including encapsulated postscript (EPS), portable document format (PDF), and scalable vector graphics (SVG).
Constructor Summary | |
|
Method Summary | |
abstract void |
|
abstract void | |
abstract void | |
void |
|
abstract void |
|
abstract boolean |
|
abstract void |
|
abstract void |
|
abstract void |
|
abstract void |
|
abstract void |
|
abstract void |
|
abstract void |
|
abstract void | |
void |
|
abstract Color |
|
abstract Composite |
|
abstract GraphicsConfiguration | |
abstract FontRenderContext |
|
abstract Paint |
|
abstract Object |
|
abstract RenderingHints |
|
abstract Stroke |
|
abstract AffineTransform |
|
abstract boolean | |
abstract void |
|
abstract void |
|
abstract void |
|
abstract void |
|
abstract void |
|
abstract void | |
abstract void |
|
abstract void |
|
abstract void | |
abstract void |
|
abstract void |
|
abstract void |
|
abstract void |
|
abstract void |
|
Methods inherited from class java.awt.Graphics | |
clearRect , clipRect , copyArea , create , create , dispose , draw3DRect , drawArc , drawBytes , drawChars , drawImage , drawImage , drawImage , drawImage , drawImage , drawImage , drawLine , drawOval , drawPolygon , drawPolygon , drawPolyline , drawRect , drawRoundRect , drawString , drawString , fill3DRect , fillArc , fillOval , fillPolygon , fillPolygon , fillRect , fillRoundRect , finalize , getClip , getClipBounds , getClipBounds , getClipRect , getColor , getFont , getFontMetrics , getFontMetrics , hitClip , setClip , setClip , setColor , setFont , setPaintMode , setXORMode , toString , translate |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
protected Graphics2D()
The basic constructor. Object is special, because it has no superclass, so there is no call to super().
public abstract void addRenderingHints(Map hints)
Adds/updates the rendering hint.
- Parameters:
hints
- the hints to add or update.
public abstract void clip(Shape s)
Sets the clip region to the intersection of the current clipping region ands
.
- Parameters:
s
- the shape to intersect with the current clipping region.
- See Also:
Graphics.setClip(Shape)
public abstract void draw(Shape shape)
Draws an outline around a shape using the current stroke and paint.
- Parameters:
shape
- the shape (null
not permitted).
- See Also:
getStroke()
,getPaint()
public void draw3DRect(int x, int y, int width, int height, boolean raised)
- Overrides:
- draw3DRect in interface Graphics
public abstract void drawGlyphVector(GlyphVector g, float x, float y)
Draws a glyph vector at the specified location.
- Parameters:
g
- the glyph vector.x
- the x-coordinate.y
- the y-coordinate.
public abstract void drawRenderableImage(RenderableImage image, AffineTransform xform)
public abstract void drawString(String text, float x, float y)
Draws a string at the specified location, using the current font.
- Parameters:
text
- the string to draw.x
- the x-coordinate.y
- the y-coordinate.
- See Also:
Graphics.setFont(Font)
public abstract void drawString(String text, int x, int y)
Draws a string at the specified location, using the current font.
- Overrides:
- drawString in interface Graphics
- Parameters:
text
- the string to draw.x
- the x-coordinate.y
- the y-coordinate.
- See Also:
Graphics.setFont(Font)
public abstract void drawString(AttributedCharacterIterator iterator, float x, float y)
Draws an attributed string at the specified location.
- Parameters:
iterator
- the source of the attributed text.x
- the x-coordinate.y
- the y-coordinate.
public abstract void drawString(AttributedCharacterIterator iterator, int x, int y)
Draws an attributed string at the specified location.
- Overrides:
- drawString in interface Graphics
- Parameters:
iterator
- the source of the attributed text.x
- the x-coordinate.y
- the y-coordinate.
public abstract void fill(Shape shape)
Fills the interior of the specifiedshape
using the current paint.
- Parameters:
shape
- the shape to fill (null
not permitted).
- See Also:
draw(Shape)
,getPaint()
public void fill3DRect(int x, int y, int width, int height, boolean raised)
- Overrides:
- fill3DRect in interface Graphics
public abstract Color getBackground()
Returns the color used by theGraphics.clearRect(int,int,int,int)
method.
- Returns:
- The background color.
- See Also:
setBackground(Color)
public abstract Composite getComposite()
Returns the current compositing rule.
- Returns:
- The current compositing rule.
- See Also:
setComposite(Composite)
public abstract FontRenderContext getFontRenderContext()
Returns the font render context.
- Returns:
- The font render context.
public abstract Paint getPaint()
Returns the current paint.
- Returns:
- The current paint.
- See Also:
setPaint(Paint)
public abstract Object getRenderingHint(RenderingHints.Key hintKey)
Returns the current value of a rendering hint.
- Parameters:
hintKey
- the key for the hint.
- Returns:
- The value for the specified hint.
public abstract RenderingHints getRenderingHints()
Returns the current rendering hints.
- Returns:
- The current rendering hints.
public abstract Stroke getStroke()
Returns the current stroke.
- Returns:
- The current stroke.
- See Also:
setStroke(Stroke)
public abstract AffineTransform getTransform()
Returns the current transform.
- Returns:
- The current transform.
- See Also:
setTransform(AffineTransform)
public abstract void setBackground(Color color)
Sets the background color (used by theGraphics.clearRect(int,int,int,int)
method).
- Parameters:
color
- the color.
- See Also:
getBackground()
public abstract void setComposite(Composite comp)
Sets the current compositing rule.
- Parameters:
comp
- the composite.
- See Also:
getComposite()
public abstract void setPaint(Paint paint)
Sets the paint to be used for subsequent drawing operations.
- Parameters:
paint
- the paint (null
not permitted).
- See Also:
getPaint()
public abstract void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
Adds or updates a hint in the current rendering hints table.
- Parameters:
hintKey
- the hint key.hintValue
- the hint value.
public abstract void setRenderingHints(Map hints)
Replaces the current rendering hints with the supplied hints.
- Parameters:
hints
- the hints.
- See Also:
addRenderingHints(Map)
public abstract void setStroke(Stroke stroke)
Sets the stroke to be used for subsequent drawing operations.
- Parameters:
stroke
- the stroke (null
not permitted).
- See Also:
getStroke()
public abstract void setTransform(AffineTransform transform)
Sets the current transform. If the caller specifies anull
transform, this method should set the current transform to the identity transform.
- Parameters:
transform
- the transform (null
permitted).
- See Also:
getTransform()
public abstract void transform(AffineTransform transform)
Sets the current transform to a concatenation oftransform
and the existing transform.
- Parameters:
transform
- the transform.