I noticed that several components that should be opaque (they are in the
JDK), are not flagged as beeing opaque in Classpath. I fixed this with
the attached patch. At the moment this only affects the drawing in that
the opaque flag decides if the ComponentUI draws the components
background or not. I am working on an improved RepaintManager that also
uses the opaque flag to optimize drawing. It would not be necessary to
step back up to the RootPane and draw everything if the opaque property
is correctly respected.

2005-06-30  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/plaf/basic/BasicMenuBarUI.java
        (installDefaults): Made JMenuBar opaque.
        * javax/swing/plaf/basic/BasicOptionPaneUI.java
        (installDefaults): Made JOptionPane opaque.
        * javax/swing/plaf/basic/BasicPanelUI.java
        (installUI): Also call installDefaults().
        (installDefaults): New method. Made JPanel opaque.
        * javax/swing/plaf/basic/BasicRootPaneUI.java
        (installDefaults): Made JRootPane opaque.
        * javax/swing/plaf/basic/BasicSeparatorUI.java
        (installDefaults): Made JSeparator opaque.
        * javax/swing/plaf/basic/BasicSpinnerUI.java
        (installDefaults): Made JSpinner opaque.
        * javax/swing/plaf/basic/BasicSplitPaneUI.java
        (installDefaults): Made JSplitPane opaque.
        * javax/swing/plaf/basic/BasicTabbedPaneUI.java
        (installDefaults): Made JSplitPane opaque.

/Roman

Index: javax/swing/plaf/basic/BasicMenuBarUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java,v
retrieving revision 1.7
diff -u -r1.7 BasicMenuBarUI.java
--- javax/swing/plaf/basic/BasicMenuBarUI.java	12 Apr 2005 19:48:44 -0000	1.7
+++ javax/swing/plaf/basic/BasicMenuBarUI.java	1 Jul 2005 10:10:19 -0000
@@ -165,6 +165,7 @@
     menuBar.setBorder(defaults.getBorder("MenuBar.border"));
     menuBar.setFont(defaults.getFont("MenuBar.font"));
     menuBar.setForeground(defaults.getColor("MenuBar.foreground"));
+    menuBar.setOpaque(true);
   }
 
   /**
Index: javax/swing/plaf/basic/BasicOptionPaneUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java,v
retrieving revision 1.17
diff -u -r1.17 BasicOptionPaneUI.java
--- javax/swing/plaf/basic/BasicOptionPaneUI.java	4 Jun 2005 19:16:11 -0000	1.17
+++ javax/swing/plaf/basic/BasicOptionPaneUI.java	1 Jul 2005 10:10:20 -0000
@@ -1146,6 +1146,7 @@
     optionPane.setBackground(defaults.getColor("OptionPane.background"));
     optionPane.setForeground(defaults.getColor("OptionPane.foreground"));
     optionPane.setBorder(defaults.getBorder("OptionPane.border"));
+    optionPane.setOpaque(true);
 
     messageBorder = defaults.getBorder("OptionPane.messageAreaBorder");
     messageForeground = defaults.getColor("OptionPane.messageForeground");
Index: javax/swing/plaf/basic/BasicPanelUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicPanelUI.java,v
retrieving revision 1.4
diff -u -r1.4 BasicPanelUI.java
--- javax/swing/plaf/basic/BasicPanelUI.java	14 Feb 2004 21:42:56 -0000	1.4
+++ javax/swing/plaf/basic/BasicPanelUI.java	1 Jul 2005 10:10:20 -0000
@@ -39,18 +39,29 @@
 package javax.swing.plaf.basic;
 
 import javax.swing.JComponent;
+import javax.swing.JPanel;
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.PanelUI;
 
 public class BasicPanelUI extends PanelUI
 {
-    public static ComponentUI createUI(JComponent x) 
-    {
-        return new BasicPanelUI();
-    }
+  public static ComponentUI createUI(JComponent x) 
+  {
+    return new BasicPanelUI();
+  }
 
-    public void installUI(JComponent c)
-    {
-      super.installUI(c);
-    }
+  public void installUI(JComponent c)
+  {
+    super.installUI(c);
+    if (c instanceof JPanel)
+      {
+	JPanel p = (JPanel) c;
+	installDefaults(p);
+      }
+  }
+
+  public void installDefaults(JPanel p)
+  {
+    p.setOpaque(true);
+  }
 }
Index: javax/swing/plaf/basic/BasicRootPaneUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java,v
retrieving revision 1.6
diff -u -r1.6 BasicRootPaneUI.java
--- javax/swing/plaf/basic/BasicRootPaneUI.java	22 Oct 2004 12:44:01 -0000	1.6
+++ javax/swing/plaf/basic/BasicRootPaneUI.java	1 Jul 2005 10:10:20 -0000
@@ -56,7 +56,6 @@
 
   public void installUI(JComponent c)
   {
-    c.setOpaque(true);
     c.setBackground(UIManager.getColor("control"));
     super.installUI(c);
   }
Index: javax/swing/plaf/basic/BasicSeparatorUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java,v
retrieving revision 1.4
diff -u -r1.4 BasicSeparatorUI.java
--- javax/swing/plaf/basic/BasicSeparatorUI.java	22 Oct 2004 12:44:01 -0000	1.4
+++ javax/swing/plaf/basic/BasicSeparatorUI.java	1 Jul 2005 10:10:20 -0000
@@ -125,7 +125,7 @@
 
     shadow = defaults.getColor("Separator.shadow");
     highlight = defaults.getColor("Separator.highlight");
-    s.setOpaque(true);
+    s.setOpaque(false);
   }
 
   /**
Index: javax/swing/plaf/basic/BasicSpinnerUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java,v
retrieving revision 1.3
diff -u -r1.3 BasicSpinnerUI.java
--- javax/swing/plaf/basic/BasicSpinnerUI.java	22 Oct 2004 12:44:01 -0000	1.3
+++ javax/swing/plaf/basic/BasicSpinnerUI.java	1 Jul 2005 10:10:20 -0000
@@ -178,6 +178,7 @@
     spinner.setBorder(defaults.getBorder("Spinner.border"));
     */
     spinner.setLayout(createLayout());
+    spinner.setOpaque(true);
   }
 
   /*
Index: javax/swing/plaf/basic/BasicSplitPaneUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java,v
retrieving revision 1.11
diff -u -r1.11 BasicSplitPaneUI.java
--- javax/swing/plaf/basic/BasicSplitPaneUI.java	10 Jun 2005 12:59:00 -0000	1.11
+++ javax/swing/plaf/basic/BasicSplitPaneUI.java	1 Jul 2005 10:10:21 -0000
@@ -1000,6 +1000,7 @@
     splitPane.setBackground(defaults.getColor("SplitPane.background"));
     splitPane.setBorder(defaults.getBorder("SplitPane.border"));
     splitPane.setDividerSize(defaults.getInt("SplitPane.dividerSize"));
+    splitPane.setOpaque(true);
   }
 
   /**
Index: javax/swing/plaf/basic/BasicTabbedPaneUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,v
retrieving revision 1.21
diff -u -r1.21 BasicTabbedPaneUI.java
--- javax/swing/plaf/basic/BasicTabbedPaneUI.java	4 Jun 2005 19:16:11 -0000	1.21
+++ javax/swing/plaf/basic/BasicTabbedPaneUI.java	1 Jul 2005 10:10:22 -0000
@@ -1541,7 +1541,7 @@
     tabPane.setFont(defaults.getFont("TabbedPane.font"));
     tabPane.setForeground(defaults.getColor("TabbedPane.foreground"));
     tabPane.setBackground(defaults.getColor("TabbedPane.background"));
-    tabPane.setOpaque(true);
+    tabPane.setOpaque(false);
 
     highlight = defaults.getColor("TabbedPane.highlight");
     lightHighlight = defaults.getColor("TabbedPane.lightHighlight");
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to