user21847419
user21847419

Reputation: 11

How to change the JMenuBar text color?

I've been working on a project which uses Java's Swing class for the first time and I have been implementing a JMenuBar. I want the ability for users to swap color schemes, but I can't figure out how to swap the text color.

So far, I have attempted to set the JMenuBar to opaque, and setting the Foreground color to the color I want it to be (similar to how labels are used) using the .setForeground() method. When I used the .setBackground() method, it worked perfectly for the background of the JMenuBar..

Upvotes: 1

Views: 64

Answers (1)

camickr
camickr

Reputation: 324207

You would need to set the foreground of each JMenu that you add to the menu bar.

JMenu test = new JMenu("Testing");
test.setForeground( Color.RED );
menuBar.add(test);

Upvotes: 3

Related Questions