src/share/classes/java/awt/Component.java

Print this page




3394                     height += y;
3395                     y = 0;
3396                 }
3397 
3398                 int pwidth = (width > this.width) ? this.width : width;
3399                 int pheight = (height > this.height) ? this.height : height;
3400 
3401                 if (pwidth <= 0 || pheight <= 0) {
3402                     return;
3403                 }
3404 
3405                 int px = this.x + x;
3406                 int py = this.y + y;
3407                 parent.repaint(tm, px, py, pwidth, pheight);
3408             }
3409         } else {
3410             if (isVisible() && (this.peer != null) &&
3411                 (width > 0) && (height > 0)) {
3412                 PaintEvent e = new PaintEvent(this, PaintEvent.UPDATE,
3413                                               new Rectangle(x, y, width, height));
3414                 Toolkit.getEventQueue().postEvent(e);
3415             }
3416         }
3417     }
3418 
3419     /**
3420      * Prints this component. Applications should override this method
3421      * for components that must do special processing before being
3422      * printed or should be printed differently than they are painted.
3423      * <p>
3424      * The default implementation of this method calls the
3425      * <code>paint</code> method.
3426      * <p>
3427      * The origin of the graphics context, its
3428      * (<code>0</code>,&nbsp;<code>0</code>) coordinate point, is the
3429      * top-left corner of this component. The clipping region of the
3430      * graphics context is the bounding rectangle of this component.
3431      * @param     g   the graphics context to use for printing
3432      * @see       #paint(Graphics)
3433      * @since     JDK1.0
3434      */




3394                     height += y;
3395                     y = 0;
3396                 }
3397 
3398                 int pwidth = (width > this.width) ? this.width : width;
3399                 int pheight = (height > this.height) ? this.height : height;
3400 
3401                 if (pwidth <= 0 || pheight <= 0) {
3402                     return;
3403                 }
3404 
3405                 int px = this.x + x;
3406                 int py = this.y + y;
3407                 parent.repaint(tm, px, py, pwidth, pheight);
3408             }
3409         } else {
3410             if (isVisible() && (this.peer != null) &&
3411                 (width > 0) && (height > 0)) {
3412                 PaintEvent e = new PaintEvent(this, PaintEvent.UPDATE,
3413                                               new Rectangle(x, y, width, height));
3414                 SunToolkit.postEvent(SunToolkit.targetToAppContext(this), e);
3415             }
3416         }
3417     }
3418 
3419     /**
3420      * Prints this component. Applications should override this method
3421      * for components that must do special processing before being
3422      * printed or should be printed differently than they are painted.
3423      * <p>
3424      * The default implementation of this method calls the
3425      * <code>paint</code> method.
3426      * <p>
3427      * The origin of the graphics context, its
3428      * (<code>0</code>,&nbsp;<code>0</code>) coordinate point, is the
3429      * top-left corner of this component. The clipping region of the
3430      * graphics context is the bounding rectangle of this component.
3431      * @param     g   the graphics context to use for printing
3432      * @see       #paint(Graphics)
3433      * @since     JDK1.0
3434      */