Hi, when a custom background color is set on a JMenuBar gradient painting should not be done. I fixed this by checking whether the curent background color is an instanceof of UIResource (this is done in other locations in plaf/metal too with the same purpose).
Now custom JMenuBar colors work. :)
ChangeLog:
2006-06-16 Robert Schuster <[EMAIL PROTECTED]>
* javax/swing/plaf/metal/MetalMenuBarUI.java:
(update): Added subexpression to if-statement.
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");
signature.asc
Description: OpenPGP digital signature
