Show the top level menus (menubar) in a button like style. This increases the contrast between the text and background texture without having to apply the brighter color to the entire menu bar.

This commit is contained in:
Stian Grenborgen 2023-05-20 12:01:15 +02:00
parent 10ca820998
commit a09ee4f10f
6 changed files with 13 additions and 3 deletions

View File

@ -38,6 +38,7 @@ image.background.ColopediaPanel=resources/images/ui/bg_brown.png
image.background.FreeColList=resource:image.background.Paper
image.background.FreeColMenuBar=resources/images/ui/bg_brown.png
image.background.FreeColMenu=resources/images/ui/bg_paper_brown.png
image.background.FreeColOptionPane=resource:image.background.Paper
image.background.FreeColPanel=resource:image.background.Paper
image.background.FreeColPopupMenu=resource:image.background.Paper

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

View File

@ -634,9 +634,13 @@ public final class ImageLibrary {
return getUnscaledImage(key);
}
public static BufferedImage getMenuBackground() {
public static BufferedImage getMenuBarBackground() {
return getUnscaledImage("image.background.FreeColMenuBar");
}
public static BufferedImage getMenuBackground() {
return getUnscaledImage("image.background.FreeColMenu");
}
public static BufferedImage getMiniMapBackground() {
return getUnscaledImage("image.background.MiniMap");

View File

@ -19,6 +19,7 @@
package net.sf.freecol.client.gui.menu;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
@ -254,7 +255,7 @@ public abstract class FreeColMenuBar extends JMenuBar {
if (isOpaque()) {
super.paintComponent(g);
} else {
ImageUtils.drawTiledImage(ImageLibrary.getMenuBackground(),
ImageUtils.drawTiledImage(ImageLibrary.getMenuBarBackground(),
g, this, getInsets());
}
}

View File

@ -121,6 +121,7 @@ public class FreeColLookAndFeel extends MetalLookAndFeel {
FreeColListUI.class,
FreeColMenuBarUI.class,
FreeColMenuItemUI.class,
FreeColMenuUI.class,
FreeColOptionPaneUI.class,
FreeColPanelUI.class,
FreeColPopupMenuUI.class,
@ -212,6 +213,9 @@ public class FreeColLookAndFeel extends MetalLookAndFeel {
u.put("CheckBox.icon", (LazyValue) t -> FreeColCheckBoxUI.createCheckBoxIcon());
// TODO: We might want to allow overriding font colors for the menu:
//u.put("Menu.foreground", java.awt.Color.WHITE);
return u;
}

View File

@ -43,7 +43,7 @@ public class FreeColMenuBarUI extends BasicMenuBarUI {
@Override
public void paint(java.awt.Graphics g, javax.swing.JComponent c) {
if (c.isOpaque()) {
ImageUtils.drawTiledImage(ImageLibrary.getMenuBackground(),
ImageUtils.drawTiledImage(ImageLibrary.getMenuBarBackground(),
g, c, null);
}
}