The JLayeredPane.paint() method should only clear the background of the
JLayeredPane if it is opaque. Fixed with the attached patch.

2005-11-14  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/JLayeredPane.java
        (paint): Only clear the background if the layeredPane is opaque.

/Roman
Index: javax/swing/JLayeredPane.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JLayeredPane.java,v
retrieving revision 1.32
diff -u -r1.32 JLayeredPane.java
--- javax/swing/JLayeredPane.java	8 Nov 2005 12:28:57 -0000	1.32
+++ javax/swing/JLayeredPane.java	14 Nov 2005 12:52:20 -0000
@@ -38,9 +38,12 @@
 
 package javax.swing;
 
+import java.awt.Color;
 import java.awt.Component;
 import java.awt.Container;
 import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.Shape;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Map;
@@ -158,6 +161,8 @@
   TreeMap layers;               // Layer Number (Integer) -> Layer Size (Integer)
   Hashtable componentToLayer;   // Component -> Layer Number (Integer)
 
+  private transient Rectangle rectCache;
+  
   public JLayeredPane()
   {
     layers = new TreeMap ();
@@ -689,8 +694,14 @@
    */
   public void paint(Graphics g)
   {
-    g.setColor(getBackground());
-    g.fillRect(0, 0, getWidth(), getHeight());
+    if (isOpaque())
+      {
+        Color oldColor = g.getColor();
+        Rectangle clip = g.getClipBounds();
+        g.setColor(getBackground());
+        g.fillRect(clip.x, clip.y, clip.width, clip.height);
+        g.setColor(oldColor);
+      }
     super.paint(g);
   }
 
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to