Hi,
this fumbles a bit with the way the gradient and the border is painted for JMenu
components.

Still need to find out how 'they' manage to join the painting of a JMenu with a
adjacent JToolBar ...

2006-08-04  Robert Schuster  <[EMAIL PROTECTED]>

        * javax/swing/plaf/metal/MetalMenuBarUI.java:
        (update): Check size and paint smaller gradient.
        * javax/swing/plaf/metal/MetalBorders.java:
        (MenuBarBorder): Removed borderColor field.
        (MenuBarBorder.paintBorder): Added note, fetch color from UIManager or
        MetalLookAndFeel.


cya
Robert
Index: javax/swing/plaf/metal/MetalMenuBarUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalMenuBarUI.java,v
retrieving revision 1.1
diff -u -r1.1 MetalMenuBarUI.java
--- javax/swing/plaf/metal/MetalMenuBarUI.java	16 Nov 2005 15:44:05 -0000	1.1
+++ javax/swing/plaf/metal/MetalMenuBarUI.java	16 Jun 2006 12:54:19 -0000
@@ -44,6 +44,7 @@
 import javax.swing.SwingConstants;
 import javax.swing.UIManager;
 import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.UIResource;
 import javax.swing.plaf.basic.BasicMenuBarUI;
 
 /**
@@ -75,7 +76,9 @@
    */
   public void update(Graphics g, JComponent c)
   {
-    if (c.isOpaque() && UIManager.get("MenuBar.gradient") != null)
+    if (c.isOpaque()
+        && UIManager.get("MenuBar.gradient") != null
+        && c.getBackground() instanceof UIResource)
       {
         MetalUtils.paintGradient(g, 0, 0, c.getWidth(), c.getHeight(),
                                  SwingConstants.VERTICAL, "MenuBar.gradient");

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to