Change background and text color of JMenuBar and JMenu objects inside it

后端 未结 7 1705
孤街浪徒
孤街浪徒 2020-12-10 20:57

How can I set custom background color for JMenuBar and JMenu objects inside it? I tried .setBackgroundColor and it does not work!

7条回答
  •  生来不讨喜
    2020-12-10 21:24

    Simple way to do is by .setBackground(Color.RED) and setOpaque(true)

    menubar.setBackground(Color.RED); menu.setBackground(Color.yellow); menubar.setOpaque(true); menu.setOpaque(true);

    This will give the color of your choices to both the menubar and menu.

提交回复
热议问题