# HG changeset patch # User Omair Majid # Date 1348702611 14400 # Node ID e3f026b1e20011861351d0df5b0ff5ef94e49a24 # Parent 73b984279227fb8fe0f85785cc05b41fb4d2ac11 Paint the menu bar Replace a no-op implementation of update() with a real implementaton. Reviewed-by: rkennke Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-September/003387.html diff -r 73b984279227 -r e3f026b1e200 dolphin/pom.xml --- a/dolphin/pom.xml Mon Sep 24 20:29:50 2012 -0400 +++ b/dolphin/pom.xml Wed Sep 26 19:36:51 2012 -0400 @@ -64,12 +64,12 @@ com.redhat.swing.laf.dolphin.text, com.redhat.swing.laf.dolphin.themes, com.redhat.swing.laf.dolphin.table, - com.redhat.swing.laf.dolphin.tree + com.redhat.swing.laf.dolphin.tree, com.redhat.swing.laf.dolphin.showcase, com.redhat.swing.laf.dolphin.showcase.table, - com.redhat.swing.laf.dolphin.showcase.tree + com.redhat.swing.laf.dolphin.showcase.tree, <_nouses>true diff -r 73b984279227 -r e3f026b1e200 dolphin/src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinMenuBarUI.java --- a/dolphin/src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinMenuBarUI.java Mon Sep 24 20:29:50 2012 -0400 +++ b/dolphin/src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinMenuBarUI.java Wed Sep 26 19:36:51 2012 -0400 @@ -39,6 +39,7 @@ import java.awt.Graphics; import javax.swing.JComponent; +import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.metal.MetalMenuBarUI; @@ -50,6 +51,9 @@ @Override public void update(Graphics g, JComponent c) { - // do nothing for now + if (c.isOpaque() && (c.getBackground() instanceof ColorUIResource)) { + g.setColor(c.getBackground()); + g.fillRect(0, 0, c.getWidth(), c.getHeight()); + } } } diff -r 73b984279227 -r e3f026b1e200 dolphin/src/main/java/com/redhat/swing/laf/dolphin/showcase/MenuDemo.java --- a/dolphin/src/main/java/com/redhat/swing/laf/dolphin/showcase/MenuDemo.java Mon Sep 24 20:29:50 2012 -0400 +++ b/dolphin/src/main/java/com/redhat/swing/laf/dolphin/showcase/MenuDemo.java Wed Sep 26 19:36:51 2012 -0400 @@ -37,11 +37,14 @@ package com.redhat.swing.laf.dolphin.showcase; import java.awt.EventQueue; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; import javax.swing.JFrame; import javax.swing.JMenuBar; import javax.swing.JMenu; import javax.swing.JMenuItem; +import javax.swing.KeyStroke; import javax.swing.UIManager; import com.redhat.swing.laf.dolphin.DolphinLookAndFeel; @@ -92,6 +95,8 @@ JMenu mnNewMenu = new JMenu("New menu"); menuBar.add(mnNewMenu); + mnNewMenu.addSeparator(); + JMenu mnNewMenu_1 = new JMenu("New menu"); mnNewMenu.add(mnNewMenu_1); @@ -105,6 +110,7 @@ mnNewMenu_1.add(mntmNewMenuItem_3); JMenuItem mntmNewMenuItem = new JMenuItem("New menu item"); + mntmNewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_DOWN_MASK)); mnNewMenu.add(mntmNewMenuItem); JMenuItem mntmNewMenuItem_1 = new JMenuItem("New menu item"); diff -r 73b984279227 -r e3f026b1e200 dolphin/src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinDefaultTheme.java --- a/dolphin/src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinDefaultTheme.java Mon Sep 24 20:29:50 2012 -0400 +++ b/dolphin/src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinDefaultTheme.java Wed Sep 26 19:36:51 2012 -0400 @@ -243,6 +243,11 @@ } @Override + public ColorUIResource getMenuBarBackgroundColor() { + return WINDOW_BACKGROUND; + } + + @Override public ColorUIResource getMenuBackgroundColor() { return WHITE; } @@ -433,7 +438,7 @@ Object[] uiDefaults = { "MenuBarUI", "com.redhat.swing.laf.dolphin.menu.DolphinMenuBarUI", - "MenuBar.background", getMenuBackgroundColor(), + "MenuBar.background", getMenuBarBackgroundColor(), "MenuBar.border", new DolphinMenuBarBorder(), "MenuUI", "com.redhat.swing.laf.dolphin.menu.DolphinMenuUI", diff -r 73b984279227 -r e3f026b1e200 dolphin/src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinTheme.java --- a/dolphin/src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinTheme.java Mon Sep 24 20:29:50 2012 -0400 +++ b/dolphin/src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinTheme.java Wed Sep 26 19:36:51 2012 -0400 @@ -96,6 +96,7 @@ public abstract ColorUIResource getWindowBackgroundColor(); + public abstract ColorUIResource getMenuBarBackgroundColor(); public abstract ColorUIResource getMenuBackgroundColor(); public abstract ColorUIResource getMenuForegroundColor(); public abstract ColorUIResource getTabAreaBackground(); @@ -138,4 +139,5 @@ abstract public int getOneTouchButtonSize(); abstract public int getOneTouchButtonOffset(); + }