Hi everyone, I'm dealing with both JMenu and JPopupMenu in a program. Looks good except when I switch from JMenu to JPopupMenu by right click, it doesnt work. How? Many thanks.

Recommended Answers

All 6 Replies

Need more info and the code that you think has to do that...
See if you assigned to your menu item the jpopmenu object.

I think that proper way is described in previous post

Lucaci: Yes, JPopupMenu(by right click) from JMenu but it doen't change the background. It's actually a program to change background.Many thanks.
mKorbel: I'll check,the menus are display on both JMenu and JPopupMenu but it's not displaying the background.Many thanks.

JPopupMenu(by right click) from JMenu but it doen't change the background. It's actually a program to change background.

This, I don't get this.

What do you mean by

it doen't change the background

? Isn't the JPopomenu showing when you right click an item from your JMenu?

Do you mean background color? If so use this, tweek as needed:

myContentPanel.getContentPane().setBackground(Color.YourColorVariable_here);
myContentPanel.getContentPane().validate();
myContentPanel.getContentPane().repaint();

Many thanks, initiatialization of image icon made it work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.