Swing: canvas overlap menu

I have a JFrame with a menu bar and a canvas covering the rest of the surface. When I click on the menu bar, the menu opens behind the Canvas, and I do not see it. Has anyone experienced this? Besides resizing the canvas (which I am reluctant to do) is there any solution?

Thanks
Vlad

+3
source share
2 answers

You are experiencing severe and mild problems.

Quick fix:

// Call this sometime before you use your menus 
JPopupMenu.setDefaultLightWeightPopupEnabled(false)

Heavy vs Light

+8
source

This happened to me when I resized the canvas that is on the JFrame. I just needed to call

Validate () on JFrame after resizing.

Good luck

+1
source

Source: https://habr.com/ru/post/1699207/


All Articles