diff options
Diffstat (limited to 'libjava/classpath/javax/swing/CellRendererPane.java')
-rw-r--r-- | libjava/classpath/javax/swing/CellRendererPane.java | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/libjava/classpath/javax/swing/CellRendererPane.java b/libjava/classpath/javax/swing/CellRendererPane.java index c59afd3188a..b3d6f6a7364 100644 --- a/libjava/classpath/javax/swing/CellRendererPane.java +++ b/libjava/classpath/javax/swing/CellRendererPane.java @@ -1,5 +1,5 @@ /* CellRendererPane.java -- - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -75,7 +75,7 @@ public class CellRendererPane extends Container implements Accessible /** * getAccessibleRole - * @returns AccessibleRole + * @return AccessibleRole */ public AccessibleRole getAccessibleRole() { @@ -169,24 +169,32 @@ public class CellRendererPane extends Container implements Accessible addImpl(c, null, 0); Rectangle oldClip = graphics.getClipBounds(); - // translate to (x,y) - graphics.translate(x, y); - graphics.clipRect(0, 0, w, h); - // set bounds of c - c.setBounds(0, 0, w, h); - - // validate if necessary - if (shouldValidate) + boolean translated = false; + try { - c.validate(); + // translate to (x,y) + graphics.translate(x, y); + translated = true; + graphics.clipRect(0, 0, w, h); + // set bounds of c + c.setBounds(0, 0, w, h); + + // validate if necessary + if (shouldValidate) + { + c.validate(); + } + + // paint component + c.paint(graphics); + } + finally + { + // untranslate g + if (translated) + graphics.translate(-x, -y); + graphics.setClip(oldClip); } - - // paint component - c.paint(graphics); - - // untranslate g - graphics.translate(-x, -y); - graphics.setClip(oldClip); } /** |