How can I set custom background color for JMenuBar
and JMenu
objects inside it? I tried .setBackgroundColor
and it does not work!
public void run() {
UIManager.put("MenuBar.background", new java.awt.Color(255, 245, 157));
UIManager.put("MenuBar.opaque", true);
UIManager.put("Menu.background", new java.awt.Color(255, 245, 157));
UIManager.put("Menu.opaque", true);
UIManager.put("MenuItem.background",new java.awt.Color(255, 245, 157));
UIManager.put("MenuItem.opaque", true);
new MenuPrincipal().setVisible(true);
}
The menubar does not change color, but the rest do (menu and menuitem)