How can I set custom background color for JMenuBar
and JMenu
objects inside it? I tried .setBackgroundColor
and it does not work!
You would probably need to change opacity of menu items, ie:
JMenuItem item= new JMenuItem("Test");
item.setOpaque(true);
item.setBackground(Color.CYAN);
You can also achieve that globally using UIManager
, for example:
UIManager.put("MenuItem.background", Color.CYAN);
UIManager.put("MenuItem.opaque", true);