< prev index next >

src/java.desktop/share/classes/sun/print/ProxyGraphics2D.java

Print this page

        

*** 109,120 **** } /* The Delegated Graphics Methods */ /** ! * Creates a new <code>Graphics</code> object that is ! * a copy of this <code>Graphics</code> object. * @return a new graphics context that is a copy of * this graphics context. * @since 1.0 */ public Graphics create() { --- 109,120 ---- } /* The Delegated Graphics Methods */ /** ! * Creates a new {@code Graphics} object that is ! * a copy of this {@code Graphics} object. * @return a new graphics context that is a copy of * this graphics context. * @since 1.0 */ public Graphics create() {
*** 378,388 **** mGraphics.setClip(x, y, width, height); } /** * Gets the current clipping area. ! * @return a <code>Shape</code> object representing the * current clipping area. * @see java.awt.Graphics#getClipBounds * @see java.awt.Graphics#clipRect * @see java.awt.Graphics#setClip(int, int, int, int) * @see java.awt.Graphics#setClip(Shape) --- 378,388 ---- mGraphics.setClip(x, y, width, height); } /** * Gets the current clipping area. ! * @return a {@code Shape} object representing the * current clipping area. * @see java.awt.Graphics#getClipBounds * @see java.awt.Graphics#clipRect * @see java.awt.Graphics#setClip(int, int, int, int) * @see java.awt.Graphics#setClip(Shape)
*** 393,408 **** } /** * Sets the current clipping area to an arbitrary clip shape. ! * Not all objects which implement the <code>Shape</code> * interface can be used to set the clip. The only ! * <code>Shape</code> objects which are guaranteed to be ! * supported are <code>Shape</code> objects which are ! * obtained via the <code>getClip</code> method and via ! * <code>Rectangle</code> objects. * @see java.awt.Graphics#getClip() * @see java.awt.Graphics#clipRect * @see java.awt.Graphics#setClip(int, int, int, int) * @since 1.1 */ --- 393,408 ---- } /** * Sets the current clipping area to an arbitrary clip shape. ! * Not all objects which implement the {@code Shape} * interface can be used to set the clip. The only ! * {@code Shape} objects which are guaranteed to be ! * supported are {@code Shape} objects which are ! * obtained via the {@code getClip} method and via ! * {@code Rectangle} objects. * @see java.awt.Graphics#getClip() * @see java.awt.Graphics#clipRect * @see java.awt.Graphics#setClip(int, int, int, int) * @since 1.1 */
*** 411,430 **** } /** * Copies an area of the component by a distance specified by ! * <code>dx</code> and <code>dy</code>. From the point specified ! * by <code>x</code> and <code>y</code>, this method * copies downwards and to the right. To copy an area of the * component to the left or upwards, specify a negative value for ! * <code>dx</code> or <code>dy</code>. * If a portion of the source rectangle lies outside the bounds * of the component, or is obscured by another window or component, ! * <code>copyArea</code> will be unable to copy the associated * pixels. The area that is omitted can be refreshed by calling ! * the component's <code>paint</code> method. * @param x the <i>x</i> coordinate of the source rectangle. * @param y the <i>y</i> coordinate of the source rectangle. * @param width the width of the source rectangle. * @param height the height of the source rectangle. * @param dx the horizontal distance to copy the pixels. --- 411,430 ---- } /** * Copies an area of the component by a distance specified by ! * {@code dx} and {@code dy}. From the point specified ! * by {@code x} and {@code y}, this method * copies downwards and to the right. To copy an area of the * component to the left or upwards, specify a negative value for ! * {@code dx} or {@code dy}. * If a portion of the source rectangle lies outside the bounds * of the component, or is obscured by another window or component, ! * {@code copyArea} will be unable to copy the associated * pixels. The area that is omitted can be refreshed by calling ! * the component's {@code paint} method. * @param x the <i>x</i> coordinate of the source rectangle. * @param y the <i>y</i> coordinate of the source rectangle. * @param width the width of the source rectangle. * @param height the height of the source rectangle. * @param dx the horizontal distance to copy the pixels.
*** 452,467 **** /** * Fills the specified rectangle. * The left and right edges of the rectangle are at ! * <code>x</code> and <code>x&nbsp;+&nbsp;width&nbsp;-&nbsp;1</code>. * The top and bottom edges are at ! * <code>y</code> and <code>y&nbsp;+&nbsp;height&nbsp;-&nbsp;1</code>. * The resulting rectangle covers an area ! * <code>width</code> pixels wide by ! * <code>height</code> pixels tall. * The rectangle is filled using the graphics context's current color. * @param x the <i>x</i> coordinate * of the rectangle to be filled. * @param y the <i>y</i> coordinate * of the rectangle to be filled. --- 452,467 ---- /** * Fills the specified rectangle. * The left and right edges of the rectangle are at ! * {@code x} and <code>x&nbsp;+&nbsp;width&nbsp;-&nbsp;1</code>. * The top and bottom edges are at ! * {@code y} and <code>y&nbsp;+&nbsp;height&nbsp;-&nbsp;1</code>. * The resulting rectangle covers an area ! * {@code width} pixels wide by ! * {@code height} pixels tall. * The rectangle is filled using the graphics context's current color. * @param x the <i>x</i> coordinate * of the rectangle to be filled. * @param y the <i>y</i> coordinate * of the rectangle to be filled.
*** 480,490 **** * color of the current drawing surface. This operation does not * use the current paint mode. * <p> * Beginning with Java&nbsp;1.1, the background color * of offscreen images may be system dependent. Applications should ! * use <code>setColor</code> followed by <code>fillRect</code> to * ensure that an offscreen image is cleared to a specific color. * @param x the <i>x</i> coordinate of the rectangle to clear. * @param y the <i>y</i> coordinate of the rectangle to clear. * @param width the width of the rectangle to clear. * @param height the height of the rectangle to clear. --- 480,490 ---- * color of the current drawing surface. This operation does not * use the current paint mode. * <p> * Beginning with Java&nbsp;1.1, the background color * of offscreen images may be system dependent. Applications should ! * use {@code setColor} followed by {@code fillRect} to * ensure that an offscreen image is cleared to a specific color. * @param x the <i>x</i> coordinate of the rectangle to clear. * @param y the <i>y</i> coordinate of the rectangle to clear. * @param width the width of the rectangle to clear. * @param height the height of the rectangle to clear.
*** 500,512 **** } /** * Draws an outlined round-cornered rectangle using this graphics * context's current color. The left and right edges of the rectangle ! * are at <code>x</code> and <code>x&nbsp;+&nbsp;width</code>, * respectively. The top and bottom edges of the rectangle are at ! * <code>y</code> and <code>y&nbsp;+&nbsp;height</code>. * @param x the <i>x</i> coordinate of the rectangle to be drawn. * @param y the <i>y</i> coordinate of the rectangle to be drawn. * @param width the width of the rectangle to be drawn. * @param height the height of the rectangle to be drawn. * @param arcWidth the horizontal diameter of the arc --- 500,512 ---- } /** * Draws an outlined round-cornered rectangle using this graphics * context's current color. The left and right edges of the rectangle ! * are at {@code x} and <code>x&nbsp;+&nbsp;width</code>, * respectively. The top and bottom edges of the rectangle are at ! * {@code y} and <code>y&nbsp;+&nbsp;height</code>. * @param x the <i>x</i> coordinate of the rectangle to be drawn. * @param y the <i>y</i> coordinate of the rectangle to be drawn. * @param width the width of the rectangle to be drawn. * @param height the height of the rectangle to be drawn. * @param arcWidth the horizontal diameter of the arc
*** 522,534 **** } /** * Fills the specified rounded corner rectangle with the current color. * The left and right edges of the rectangle ! * are at <code>x</code> and <code>x&nbsp;+&nbsp;width&nbsp;-&nbsp;1</code>, * respectively. The top and bottom edges of the rectangle are at ! * <code>y</code> and <code>y&nbsp;+&nbsp;height&nbsp;-&nbsp;1</code>. * @param x the <i>x</i> coordinate of the rectangle to be filled. * @param y the <i>y</i> coordinate of the rectangle to be filled. * @param width the width of the rectangle to be filled. * @param height the height of the rectangle to be filled. * @param arcWidth the horizontal diameter --- 522,534 ---- } /** * Fills the specified rounded corner rectangle with the current color. * The left and right edges of the rectangle ! * are at {@code x} and <code>x&nbsp;+&nbsp;width&nbsp;-&nbsp;1</code>, * respectively. The top and bottom edges of the rectangle are at ! * {@code y} and <code>y&nbsp;+&nbsp;height&nbsp;-&nbsp;1</code>. * @param x the <i>x</i> coordinate of the rectangle to be filled. * @param y the <i>y</i> coordinate of the rectangle to be filled. * @param width the width of the rectangle to be filled. * @param height the height of the rectangle to be filled. * @param arcWidth the horizontal diameter
*** 544,555 **** } /** * Draws the outline of an oval. * The result is a circle or ellipse that fits within the ! * rectangle specified by the <code>x</code>, <code>y</code>, ! * <code>width</code>, and <code>height</code> arguments. * <p> * The oval covers an area that is * <code>width&nbsp;+&nbsp;1</code> pixels wide * and <code>height&nbsp;+&nbsp;1</code> pixels tall. * @param x the <i>x</i> coordinate of the upper left --- 544,555 ---- } /** * Draws the outline of an oval. * The result is a circle or ellipse that fits within the ! * rectangle specified by the {@code x}, {@code y}, ! * {@code width}, and {@code height} arguments. * <p> * The oval covers an area that is * <code>width&nbsp;+&nbsp;1</code> pixels wide * and <code>height&nbsp;+&nbsp;1</code> pixels tall. * @param x the <i>x</i> coordinate of the upper left
*** 583,602 **** /** * Draws the outline of a circular or elliptical arc * covering the specified rectangle. * <p> ! * The resulting arc begins at <code>startAngle</code> and extends ! * for <code>arcAngle</code> degrees, using the current color. * Angles are interpreted such that 0&nbsp;degrees * is at the 3&nbsp;o'clock position. * A positive value indicates a counter-clockwise rotation * while a negative value indicates a clockwise rotation. * <p> * The center of the arc is the center of the rectangle whose origin * is (<i>x</i>,&nbsp;<i>y</i>) and whose size is specified by the ! * <code>width</code> and <code>height</code> arguments. * <p> * The resulting arc covers an area * <code>width&nbsp;+&nbsp;1</code> pixels wide * by <code>height&nbsp;+&nbsp;1</code> pixels tall. * @param x the <i>x</i> coordinate of the --- 583,602 ---- /** * Draws the outline of a circular or elliptical arc * covering the specified rectangle. * <p> ! * The resulting arc begins at {@code startAngle} and extends ! * for {@code arcAngle} degrees, using the current color. * Angles are interpreted such that 0&nbsp;degrees * is at the 3&nbsp;o'clock position. * A positive value indicates a counter-clockwise rotation * while a negative value indicates a clockwise rotation. * <p> * The center of the arc is the center of the rectangle whose origin * is (<i>x</i>,&nbsp;<i>y</i>) and whose size is specified by the ! * {@code width} and {@code height} arguments. * <p> * The resulting arc covers an area * <code>width&nbsp;+&nbsp;1</code> pixels wide * by <code>height&nbsp;+&nbsp;1</code> pixels tall. * @param x the <i>x</i> coordinate of the
*** 617,636 **** } /** * Fills a circular or elliptical arc covering the specified rectangle. * <p> ! * The resulting arc begins at <code>startAngle</code> and extends ! * for <code>arcAngle</code> degrees. * Angles are interpreted such that 0&nbsp;degrees * is at the 3&nbsp;o'clock position. * A positive value indicates a counter-clockwise rotation * while a negative value indicates a clockwise rotation. * <p> * The center of the arc is the center of the rectangle whose origin * is (<i>x</i>,&nbsp;<i>y</i>) and whose size is specified by the ! * <code>width</code> and <code>height</code> arguments. * <p> * The resulting arc covers an area * <code>width&nbsp;+&nbsp;1</code> pixels wide * by <code>height&nbsp;+&nbsp;1</code> pixels tall. * @param x the <i>x</i> coordinate of the --- 617,636 ---- } /** * Fills a circular or elliptical arc covering the specified rectangle. * <p> ! * The resulting arc begins at {@code startAngle} and extends ! * for {@code arcAngle} degrees. * Angles are interpreted such that 0&nbsp;degrees * is at the 3&nbsp;o'clock position. * A positive value indicates a counter-clockwise rotation * while a negative value indicates a clockwise rotation. * <p> * The center of the arc is the center of the rectangle whose origin * is (<i>x</i>,&nbsp;<i>y</i>) and whose size is specified by the ! * {@code width} and {@code height} arguments. * <p> * The resulting arc covers an area * <code>width&nbsp;+&nbsp;1</code> pixels wide * by <code>height&nbsp;+&nbsp;1</code> pixels tall. * @param x the <i>x</i> coordinate of the
*** 670,689 **** /** * Draws a closed polygon defined by * arrays of <i>x</i> and <i>y</i> coordinates. * Each pair of (<i>x</i>,&nbsp;<i>y</i>) coordinates defines a point. * <p> ! * This method draws the polygon defined by <code>nPoint</code> line * segments, where the first <code>nPoint&nbsp;-&nbsp;1</code> * line segments are line segments from * <code>(xPoints[i&nbsp;-&nbsp;1],&nbsp;yPoints[i&nbsp;-&nbsp;1])</code> * to <code>(xPoints[i],&nbsp;yPoints[i])</code>, for ! * 1&nbsp;&le;&nbsp;<i>i</i>&nbsp;&le;&nbsp;<code>nPoints</code>. * The figure is automatically closed by drawing a line connecting * the final point to the first point, if those points are different. ! * @param xPoints a an array of <code>x</code> coordinates. ! * @param yPoints a an array of <code>y</code> coordinates. * @param nPoints a the total number of points. * @see java.awt.Graphics#fillPolygon * @see java.awt.Graphics#drawPolyline * @since 1.0 */ --- 670,689 ---- /** * Draws a closed polygon defined by * arrays of <i>x</i> and <i>y</i> coordinates. * Each pair of (<i>x</i>,&nbsp;<i>y</i>) coordinates defines a point. * <p> ! * This method draws the polygon defined by {@code nPoint} line * segments, where the first <code>nPoint&nbsp;-&nbsp;1</code> * line segments are line segments from * <code>(xPoints[i&nbsp;-&nbsp;1],&nbsp;yPoints[i&nbsp;-&nbsp;1])</code> * to <code>(xPoints[i],&nbsp;yPoints[i])</code>, for ! * 1&nbsp;&le;&nbsp;<i>i</i>&nbsp;&le;&nbsp;{@code nPoints}. * The figure is automatically closed by drawing a line connecting * the final point to the first point, if those points are different. ! * @param xPoints a an array of {@code x} coordinates. ! * @param yPoints a an array of {@code y} coordinates. * @param nPoints a the total number of points. * @see java.awt.Graphics#fillPolygon * @see java.awt.Graphics#drawPolyline * @since 1.0 */
*** 694,716 **** /** * Fills a closed polygon defined by * arrays of <i>x</i> and <i>y</i> coordinates. * <p> ! * This method draws the polygon defined by <code>nPoint</code> line * segments, where the first <code>nPoint&nbsp;-&nbsp;1</code> * line segments are line segments from * <code>(xPoints[i&nbsp;-&nbsp;1],&nbsp;yPoints[i&nbsp;-&nbsp;1])</code> * to <code>(xPoints[i],&nbsp;yPoints[i])</code>, for ! * 1&nbsp;&le;&nbsp;<i>i</i>&nbsp;&le;&nbsp;<code>nPoints</code>. * The figure is automatically closed by drawing a line connecting * the final point to the first point, if those points are different. * <p> * The area inside the polygon is defined using an * even-odd fill rule, also known as the alternating rule. ! * @param xPoints a an array of <code>x</code> coordinates. ! * @param yPoints a an array of <code>y</code> coordinates. * @param nPoints a the total number of points. * @see java.awt.Graphics#drawPolygon(int[], int[], int) * @since 1.0 */ public void fillPolygon(int xPoints[], int yPoints[], --- 694,716 ---- /** * Fills a closed polygon defined by * arrays of <i>x</i> and <i>y</i> coordinates. * <p> ! * This method draws the polygon defined by {@code nPoint} line * segments, where the first <code>nPoint&nbsp;-&nbsp;1</code> * line segments are line segments from * <code>(xPoints[i&nbsp;-&nbsp;1],&nbsp;yPoints[i&nbsp;-&nbsp;1])</code> * to <code>(xPoints[i],&nbsp;yPoints[i])</code>, for ! * 1&nbsp;&le;&nbsp;<i>i</i>&nbsp;&le;&nbsp;{@code nPoints}. * The figure is automatically closed by drawing a line connecting * the final point to the first point, if those points are different. * <p> * The area inside the polygon is defined using an * even-odd fill rule, also known as the alternating rule. ! * @param xPoints a an array of {@code x} coordinates. ! * @param yPoints a an array of {@code y} coordinates. * @param nPoints a the total number of points. * @see java.awt.Graphics#drawPolygon(int[], int[], int) * @since 1.0 */ public void fillPolygon(int xPoints[], int yPoints[],
*** 794,804 **** * This method returns immediately in all cases, even if the * complete image has not yet been loaded, and it has not been dithered * and converted for the current output device. * <p> * If the image has not yet been completely loaded, then ! * <code>drawImage</code> returns <code>false</code>. As more of * the image becomes available, the process that draws the image notifies * the specified image observer. * @param img the specified image to be drawn. * @param x the <i>x</i> coordinate. * @param y the <i>y</i> coordinate. --- 794,804 ---- * This method returns immediately in all cases, even if the * complete image has not yet been loaded, and it has not been dithered * and converted for the current output device. * <p> * If the image has not yet been completely loaded, then ! * {@code drawImage} returns {@code false}. As more of * the image becomes available, the process that draws the image notifies * the specified image observer. * @param img the specified image to be drawn. * @param x the <i>x</i> coordinate. * @param y the <i>y</i> coordinate.
*** 826,838 **** * <p> * This method returns immediately in all cases, even if the * entire image has not yet been scaled, dithered, and converted * for the current output device. * If the current output representation is not yet complete, then ! * <code>drawImage</code> returns <code>false</code>. As more of * the image becomes available, the process that draws the image notifies ! * the image observer by calling its <code>imageUpdate</code> method. * <p> * A scaled version of an image will not necessarily be * available immediately just because an unscaled version of the * image has been constructed for this output device. Each size of * the image may be cached separately and generated from the original --- 826,838 ---- * <p> * This method returns immediately in all cases, even if the * entire image has not yet been scaled, dithered, and converted * for the current output device. * If the current output representation is not yet complete, then ! * {@code drawImage} returns {@code false}. As more of * the image becomes available, the process that draws the image notifies ! * the image observer by calling its {@code imageUpdate} method. * <p> * A scaled version of an image will not necessarily be * available immediately just because an unscaled version of the * image has been constructed for this output device. Each size of * the image may be cached separately and generated from the original
*** 870,880 **** * This method returns immediately in all cases, even if the * complete image has not yet been loaded, and it has not been dithered * and converted for the current output device. * <p> * If the image has not yet been completely loaded, then ! * <code>drawImage</code> returns <code>false</code>. As more of * the image becomes available, the process that draws the image notifies * the specified image observer. * @param img the specified image to be drawn. * @param x the <i>x</i> coordinate. * @param y the <i>y</i> coordinate. --- 870,880 ---- * This method returns immediately in all cases, even if the * complete image has not yet been loaded, and it has not been dithered * and converted for the current output device. * <p> * If the image has not yet been completely loaded, then ! * {@code drawImage} returns {@code false}. As more of * the image becomes available, the process that draws the image notifies * the specified image observer. * @param img the specified image to be drawn. * @param x the <i>x</i> coordinate. * @param y the <i>y</i> coordinate.
*** 921,931 **** * <p> * This method returns immediately in all cases, even if the * entire image has not yet been scaled, dithered, and converted * for the current output device. * If the current output representation is not yet complete then ! * <code>drawImage</code> returns <code>false</code>. As more of * the image becomes available, the process that draws the image notifies * the specified image observer. * <p> * A scaled version of an image will not necessarily be * available immediately just because an unscaled version of the --- 921,931 ---- * <p> * This method returns immediately in all cases, even if the * entire image has not yet been scaled, dithered, and converted * for the current output device. * If the current output representation is not yet complete then ! * {@code drawImage} returns {@code false}. As more of * the image becomes available, the process that draws the image notifies * the specified image observer. * <p> * A scaled version of an image will not necessarily be * available immediately just because an unscaled version of the
*** 976,986 **** * <p> * This method returns immediately in all cases, even if the * image area to be drawn has not yet been scaled, dithered, and converted * for the current output device. * If the current output representation is not yet complete then ! * <code>drawImage</code> returns <code>false</code>. As more of * the image becomes available, the process that draws the image notifies * the specified image observer. * <p> * This method always uses the unscaled version of the image * to render the scaled rectangle and performs the required --- 976,986 ---- * <p> * This method returns immediately in all cases, even if the * image area to be drawn has not yet been scaled, dithered, and converted * for the current output device. * If the current output representation is not yet complete then ! * {@code drawImage} returns {@code false}. As more of * the image becomes available, the process that draws the image notifies * the specified image observer. * <p> * This method always uses the unscaled version of the image * to render the scaled rectangle and performs the required
*** 1036,1046 **** * <p> * This method returns immediately in all cases, even if the * image area to be drawn has not yet been scaled, dithered, and converted * for the current output device. * If the current output representation is not yet complete then ! * <code>drawImage</code> returns <code>false</code>. As more of * the image becomes available, the process that draws the image notifies * the specified image observer. * <p> * This method always uses the unscaled version of the image * to render the scaled rectangle and performs the required --- 1036,1046 ---- * <p> * This method returns immediately in all cases, even if the * image area to be drawn has not yet been scaled, dithered, and converted * for the current output device. * If the current output representation is not yet complete then ! * {@code drawImage} returns {@code false}. As more of * the image becomes available, the process that draws the image notifies * the specified image observer. * <p> * This method always uses the unscaled version of the image * to render the scaled rectangle and performs the required
*** 1104,1114 **** return result; } /** ! * Return true if drawing <code>img</code> will * invoke a Java2D bug (#4258675). The bug in question * occurs when a draw image call with a background color * parameter tries to render a sheared * or rotated image. The portions of the bounding * rectangle not covered by the sheared image --- 1104,1114 ---- return result; } /** ! * Return true if drawing {@code img} will * invoke a Java2D bug (#4258675). The bug in question * occurs when a draw image call with a background color * parameter tries to render a sheared * or rotated image. The portions of the bounding * rectangle not covered by the sheared image
*** 1124,1141 **** & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0; } /** ! * Return a new <code>BufferedImage</code> * that contains a copy of the provided ! * <code>Image</code> where its * transparent pixels have been replaced by ! * <code>bgcolor</code>. If the new ! * <code>BufferedImage</code> can not be created, * probably because the original image has not ! * finished loading, then <code>null</code> is * returned. */ private BufferedImage getBufferedImageCopy(Image img, Color bgcolor) { BufferedImage imageCopy = null; --- 1124,1141 ---- & (AffineTransform.TYPE_GENERAL_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0; } /** ! * Return a new {@code BufferedImage} * that contains a copy of the provided ! * {@code Image} where its * transparent pixels have been replaced by ! * {@code bgcolor}. If the new ! * {@code BufferedImage} can not be created, * probably because the original image has not ! * finished loading, then {@code null} is * returned. */ private BufferedImage getBufferedImageCopy(Image img, Color bgcolor) { BufferedImage imageCopy = null;
*** 1230,1257 **** } /** * Disposes of this graphics context and releases * any system resources that it is using. ! * A <code>Graphics</code> object cannot be used after ! * <code>dispose</code>has been called. * <p> ! * When a Java program runs, a large number of <code>Graphics</code> * objects can be created within a short time frame. * Although the finalization process of the garbage collector * also disposes of the same system resources, it is preferable * to manually free the associated resources by calling this * method rather than to rely on a finalization process which * may not run to completion for a long period of time. * <p> * Graphics objects which are provided as arguments to the ! * <code>paint</code> and <code>update</code> methods * of components are automatically released by the system when * those methods return. For efficiency, programmers should ! * call <code>dispose</code> when finished using ! * a <code>Graphics</code> object only if it was created ! * directly from a component or another <code>Graphics</code> object. * @see java.awt.Graphics#finalize * @see java.awt.Component#paint * @see java.awt.Component#update * @see java.awt.Component#getGraphics * @see java.awt.Graphics#create --- 1230,1257 ---- } /** * Disposes of this graphics context and releases * any system resources that it is using. ! * A {@code Graphics} object cannot be used after ! * {@code dispose} has been called. * <p> ! * When a Java program runs, a large number of {@code Graphics} * objects can be created within a short time frame. * Although the finalization process of the garbage collector * also disposes of the same system resources, it is preferable * to manually free the associated resources by calling this * method rather than to rely on a finalization process which * may not run to completion for a long period of time. * <p> * Graphics objects which are provided as arguments to the ! * {@code paint} and {@code update} methods * of components are automatically released by the system when * those methods return. For efficiency, programmers should ! * call {@code dispose} when finished using ! * a {@code Graphics} object only if it was created ! * directly from a component or another {@code Graphics} object. * @see java.awt.Graphics#finalize * @see java.awt.Component#paint * @see java.awt.Component#update * @see java.awt.Component#getGraphics * @see java.awt.Graphics#create
< prev index next >