huxendupsel
huxendupsel

Reputation:

customize JMenuBar (e.g. BackgroundImage, highlighting color,...)

I'd like to adapt/customize the appearance of my JMenuBar, so i do a little research. Now i wondering why there are so little information about this issue?!

I just found one good source here: http://forums.sun.com thread.jspa?messageID=4457769#4457769 which allows me to use a BackgroundImage for the MenuBar. The drawback is that i have to create such things like rollover effect (highlight BackgroundColor of JMenuItems), calculation of the jmenu positions by myself.

Did anyone of you knows a better, easier way to approach my goal? All i'd like to do is to customize the background of the JMenuBar by displaying a image instead of a plain color. Further the rollover-Effekts and the normal behaviour of a menu should be obtained.

Upvotes: 0

Views: 2746

Answers (2)

Dibosh
Dibosh

Reputation: 11

try something like this for jmenu positioning:

menuBar.setLayout(null);
openMenu.setBounds(pos_x,pos_y,width,height);
menuBar.add(openMenu);

I am also trying to change the background color,but still didnt find any way. :(

Upvotes: 1

akf
akf

Reputation: 39485

here is another thread in the sun forums that show something similar to what you are trying: the developer overrides the paintComponent() method on the JMenuBar to draw an image.

Upvotes: 0

Related Questions