< prev index next >

src/java.desktop/share/classes/javax/swing/RepaintManager.java

Print this page

        

*** 51,65 **** /** * This class manages repaint requests, allowing the number * of repaints to be minimized, for example by collapsing multiple * requests into a single repaint for members of a component tree. * <p> ! * As of 1.6 <code>RepaintManager</code> handles repaint requests ! * for Swing's top level components (<code>JApplet</code>, ! * <code>JWindow</code>, <code>JFrame</code> and <code>JDialog</code>). ! * Any calls to <code>repaint</code> on one of these will call into the ! * appropriate <code>addDirtyRegion</code> method. * * @author Arnaud Weber * @since 1.2 */ public class RepaintManager --- 51,65 ---- /** * This class manages repaint requests, allowing the number * of repaints to be minimized, for example by collapsing multiple * requests into a single repaint for members of a component tree. * <p> ! * As of 1.6 {@code RepaintManager} handles repaint requests ! * for Swing's top level components ({@code JApplet}, ! * {@code JWindow}, {@code JFrame} and {@code JDialog}). ! * Any calls to {@code repaint} on one of these will call into the ! * appropriate {@code addDirtyRegion} method. * * @author Arnaud Weber * @since 1.2 */ public class RepaintManager
*** 137,147 **** // The maximum number of times Swing will attempt to use the VolatileImage // buffer during a paint operation. private static final int VOLATILE_LOOP_MAX = 2; /** ! * Number of <code>beginPaint</code> that have been invoked. */ private int paintDepth = 0; /** * Type of buffer strategy to use. Will be one of the BUFFER_STRATEGY_ --- 137,147 ---- // The maximum number of times Swing will attempt to use the VolatileImage // buffer during a paint operation. private static final int VOLATILE_LOOP_MAX = 2; /** ! * Number of {@code beginPaint} that have been invoked. */ private int paintDepth = 0; /** * Type of buffer strategy to use. Will be one of the BUFFER_STRATEGY_
*** 160,170 **** // paintImmediately will be invoked on the repaintRoot. In this // way we don't try to show garbage to the screen. // /** * True if we're in the process of painting the dirty regions. This is ! * set to true in <code>paintDirtyRegions</code>. */ private boolean painting; /** * If the PaintManager calls into repaintRoot during painting this field * will be set to the root. --- 160,170 ---- // paintImmediately will be invoked on the repaintRoot. In this // way we don't try to show garbage to the screen. // /** * True if we're in the process of painting the dirty regions. This is ! * set to true in {@code paintDirtyRegions}. */ private boolean painting; /** * If the PaintManager calls into repaintRoot during painting this field * will be set to the root.
*** 490,500 **** } addDirtyRegion0(c, x, y, w, h); } /** ! * Adds <code>window</code> to the list of <code>Component</code>s that * need to be repainted. * * @param window Window to repaint, null results in nothing happening. * @param x X coordinate of the region to repaint * @param y Y coordinate of the region to repaint --- 490,500 ---- } addDirtyRegion0(c, x, y, w, h); } /** ! * Adds {@code window} to the list of {@code Component}s that * need to be repainted. * * @param window Window to repaint, null results in nothing happening. * @param x X coordinate of the region to repaint * @param y Y coordinate of the region to repaint
*** 508,518 **** public void addDirtyRegion(Window window, int x, int y, int w, int h) { addDirtyRegion0(window, x, y, w, h); } /** ! * Adds <code>applet</code> to the list of <code>Component</code>s that * need to be repainted. * * @param applet Applet to repaint, null results in nothing happening. * @param x X coordinate of the region to repaint * @param y Y coordinate of the region to repaint --- 508,518 ---- public void addDirtyRegion(Window window, int x, int y, int w, int h) { addDirtyRegion0(window, x, y, w, h); } /** ! * Adds {@code applet} to the list of {@code Component}s that * need to be repainted. * * @param applet Applet to repaint, null results in nothing happening. * @param x X coordinate of the region to repaint * @param y Y coordinate of the region to repaint
*** 603,613 **** /** * Extends the dirty region for the specified component to include * the new region. * ! * @return false if <code>c</code> is not yet marked dirty. */ private synchronized boolean extendDirtyRegion( Component c, int x, int y, int w, int h) { Rectangle r = dirtyComponents.get(c); if (r != null) { --- 603,613 ---- /** * Extends the dirty region for the specified component to include * the new region. * ! * @return false if {@code c} is not yet marked dirty. */ private synchronized boolean extendDirtyRegion( Component c, int x, int y, int w, int h) { Rectangle r = dirtyComponents.get(c); if (r != null) {
*** 1004,1016 **** } /** * Return the offscreen buffer that should be used as a double buffer with ! * the component <code>c</code>. * By default there is a double buffer per RepaintManager. ! * The buffer might be smaller than <code>(proposedWidth,proposedHeight)</code> * This happens when the maximum double buffer size as been set for the receiving * repaint manager. * * @param c the component * @param proposedWidth the width of the buffer --- 1004,1016 ---- } /** * Return the offscreen buffer that should be used as a double buffer with ! * the component {@code c}. * By default there is a double buffer per RepaintManager. ! * The buffer might be smaller than {@code (proposedWidth,proposedHeight)} * This happens when the maximum double buffer size as been set for the receiving * repaint manager. * * @param c the component * @param proposedWidth the width of the buffer
*** 1026,1039 **** return _getOffscreenBuffer(c, proposedWidth, proposedHeight); } /** * Return a volatile offscreen buffer that should be used as a ! * double buffer with the specified component <code>c</code>. * The image returned will be an instance of VolatileImage, or null * if a VolatileImage object could not be instantiated. ! * This buffer might be smaller than <code>(proposedWidth,proposedHeight)</code>. * This happens when the maximum double buffer size has been set for this * repaint manager. * * @param c the component * @param proposedWidth the width of the buffer --- 1026,1039 ---- return _getOffscreenBuffer(c, proposedWidth, proposedHeight); } /** * Return a volatile offscreen buffer that should be used as a ! * double buffer with the specified component {@code c}. * The image returned will be an instance of VolatileImage, or null * if a VolatileImage object could not be instantiated. ! * This buffer might be smaller than {@code (proposedWidth,proposedHeight)}. * This happens when the maximum double buffer size has been set for this * repaint manager. * * @param c the component * @param proposedWidth the width of the buffer
*** 1218,1231 **** /** * Returns true if this RepaintManager is double buffered. * The default value for this property may vary from platform * to platform. On platforms where native double buffering ! * is supported in the AWT, the default value will be <code>false</code> * to avoid unnecessary buffering in Swing. * On platforms where native double buffering is not supported, ! * the default value will be <code>true</code>. * * @return true if this object is double buffered */ public boolean isDoubleBufferingEnabled() { return doubleBufferingEnabled; --- 1218,1231 ---- /** * Returns true if this RepaintManager is double buffered. * The default value for this property may vary from platform * to platform. On platforms where native double buffering ! * is supported in the AWT, the default value will be {@code false} * to avoid unnecessary buffering in Swing. * On platforms where native double buffering is not supported, ! * the default value will be {@code true}. * * @return true if this object is double buffered */ public boolean isDoubleBufferingEnabled() { return doubleBufferingEnabled;
*** 1251,1262 **** image.flush(); } } /** ! * Returns true if we should use the <code>Image</code> returned ! * from <code>getVolatileOffscreenBuffer</code> to do double buffering. */ boolean useVolatileDoubleBuffer() { return volatileImageBufferEnabled; } --- 1251,1262 ---- image.flush(); } } /** ! * Returns true if we should use the {@code Image} returned ! * from {@code getVolatileOffscreenBuffer} to do double buffering. */ boolean useVolatileDoubleBuffer() { return volatileImageBufferEnabled; }
*** 1344,1356 **** } } /** * Invoked prior to any paint/copyArea method calls. This will ! * be followed by an invocation of <code>endPaint</code>. * <b>WARNING</b>: Callers of this method need to wrap the call ! * in a <code>try/finally</code>, otherwise if an exception is thrown * during the course of painting the RepaintManager may * be left in a state in which the screen is not updated, eg: * <pre> * repaintManager.beginPaint(); * try { --- 1344,1356 ---- } } /** * Invoked prior to any paint/copyArea method calls. This will ! * be followed by an invocation of {@code endPaint}. * <b>WARNING</b>: Callers of this method need to wrap the call ! * in a {@code try/finally}, otherwise if an exception is thrown * during the course of painting the RepaintManager may * be left in a state in which the screen is not updated, eg: * <pre> * repaintManager.beginPaint(); * try {
*** 1377,1387 **** getPaintManager().beginPaint(); } } /** ! * Invoked after <code>beginPaint</code> has been invoked. */ void endPaint() { if (isPaintingThread()) { PaintManager paintManager = null; synchronized(this) { --- 1377,1387 ---- getPaintManager().beginPaint(); } } /** ! * Invoked after {@code beginPaint} has been invoked. */ void endPaint() { if (isPaintingThread()) { PaintManager paintManager = null; synchronized(this) {
*** 1416,1426 **** void doubleBufferingChanged(JRootPane rootPane) { getPaintManager().doubleBufferingChanged(rootPane); } /** ! * Sets the <code>PaintManager</code> that is used to handle all * double buffered painting. * * @param paintManager The PaintManager to use. Passing in null indicates * the fallback PaintManager should be used. */ --- 1416,1426 ---- void doubleBufferingChanged(JRootPane rootPane) { getPaintManager().doubleBufferingChanged(rootPane); } /** ! * Sets the {@code PaintManager} that is used to handle all * double buffered painting. * * @param paintManager The PaintManager to use. Passing in null indicates * the fallback PaintManager should be used. */
*** 1483,1493 **** /** * PaintManager is used to handle all double buffered painting for * Swing. Subclasses should call back into the JComponent method ! * <code>paintToOffscreen</code> to handle the actual painting. */ static class PaintManager { /** * RepaintManager the PaintManager has been installed on. */ --- 1483,1493 ---- /** * PaintManager is used to handle all double buffered painting for * Swing. Subclasses should call back into the JComponent method ! * {@code paintToOffscreen} to handle the actual painting. */ static class PaintManager { /** * RepaintManager the PaintManager has been installed on. */
*** 1625,1635 **** osg.dispose(); } } /** ! * If <code>image</code> is non-null with a positive size it * is returned, otherwise null is returned. */ private Image getValidImage(Image image) { if (image != null && image.getWidth(null) > 0 && image.getHeight(null) > 0) { --- 1625,1635 ---- osg.dispose(); } } /** ! * If {@code image} is non-null with a positive size it * is returned, otherwise null is returned. */ private Image getValidImage(Image image) { if (image != null && image.getWidth(null) > 0 && image.getHeight(null) > 0) {
*** 1638,1648 **** return null; } /** * Schedules a repaint for the specified component. This differs ! * from <code>root.repaint</code> in that if the RepaintManager is * currently processing paint requests it'll process this request * with the current set of requests. */ protected void repaintRoot(JComponent root) { assert (repaintManager.repaintRoot == null); --- 1638,1648 ---- return null; } /** * Schedules a repaint for the specified component. This differs ! * from {@code root.repaint} in that if the RepaintManager is * currently processing paint requests it'll process this request * with the current set of requests. */ protected void repaintRoot(JComponent root) { assert (repaintManager.repaintRoot == null);
*** 1654,1664 **** } } /** * Returns true if the component being painted is the root component ! * that was previously passed to <code>repaintRoot</code>. */ protected boolean isRepaintingRoot() { return isRepaintingRoot; } --- 1654,1664 ---- } } /** * Returns true if the component being painted is the root component ! * that was previously passed to {@code repaintRoot}. */ protected boolean isRepaintingRoot() { return isRepaintingRoot; }
< prev index next >