diff options
Diffstat (limited to 'libjava/java/awt/Component.java')
-rw-r--r-- | libjava/java/awt/Component.java | 52 |
1 files changed, 12 insertions, 40 deletions
diff --git a/libjava/java/awt/Component.java b/libjava/java/awt/Component.java index b440c51..87c73b5 100644 --- a/libjava/java/awt/Component.java +++ b/libjava/java/awt/Component.java @@ -1702,6 +1702,9 @@ public abstract class Component */ public void paint(Graphics g) { + // Paint the heavyweight peer + if (!isLightweight() && peer != null) + peer.paint(g); } /** @@ -1719,6 +1722,15 @@ public abstract class Component */ public void update(Graphics g) { + if (!isLightweight()) + { + Rectangle clip = g.getClipBounds(); + if (clip == null) + g.clearRect(0, 0, width, height); + else + g.clearRect(clip.x, clip.y, clip.width, clip.height); + } + paint(g); } @@ -1732,8 +1744,6 @@ public abstract class Component { if (! visible) return; - if (peer != null) - peer.paint(g); paint(g); } @@ -2787,8 +2797,6 @@ public abstract class Component if (e instanceof FocusEvent) processFocusEvent((FocusEvent) e); - else if (e instanceof PaintEvent) - processPaintEvent((PaintEvent) e); else if (e instanceof MouseWheelEvent) processMouseWheelEvent((MouseWheelEvent) e); else if (e instanceof MouseEvent) @@ -4225,42 +4233,6 @@ p * <li>the set of backward traversal keys } /** - * Does the work for a paint event. - * - * @param event the event to process - */ - private void processPaintEvent(PaintEvent event) - { - // Can't do graphics without peer - if (peer == null) - return; - - Graphics gfx = getGraphics(); - try - { - Shape clip = event.getUpdateRect(); - gfx.setClip(clip); - - switch (event.id) - { - case PaintEvent.PAINT: - paint(gfx); - break; - case PaintEvent.UPDATE: - update(gfx); - break; - default: - throw new IllegalArgumentException("unknown paint event"); - } - event.consume (); - } - finally - { - gfx.dispose(); - } - } - - /** * This method is used to implement transferFocus(). CHILD is the child * making the request. This is overridden by Container; when called for an * ordinary component there is no child and so we always return null. |