1

I am working with the ImageJ 3D Viewer library (http://3dviewer.neurofly.de/). I am trying to display an image in the viewer, but the popup menu (menu options) are being obscured by the canvas. That is, they disappear behind the canvas. I looked all over, and the consensus answer seems that I should add this line of code early:

JPopupMenu.setDefaultLightWeightPopupEnabled(false);

I added this very early, but the issue still remains. Anyone have any ideas? I could post code, but that's the essential idea. I am trying to add a JMenuBar to a Canvas3D.

pyrrhic
  • 1,769
  • 2
  • 15
  • 27

1 Answers1

0

Maybe try adding your Canvas3D to a JPanel? from http://www.velocityreviews.com/forums/t144174-canvas3d-overlaps-jmenu.html

EGHM
  • 2,144
  • 23
  • 37
  • Sorry, the Canvas3D is already being added to a JFrame. The JMenuBar being edited is part of the JFrame. – pyrrhic Jul 02 '13 at 03:37
  • Have you tried adding the Canvas3D to a JPanel and add that to the JFrame? – EGHM Jul 02 '13 at 03:38
  • Sorry, I tried adding it to a JPanel, but there are some dependencies that make that difficult. Maybe I can try to fiddle around so that it can do that, but in the meantime, maybe other ideas? – pyrrhic Jul 02 '13 at 03:51
  • Maybe try to layout your UI so it isn't trying to paint light weight components over the Canvas3D? Like have a separate JFrame to make use of the JMenu on? Though it might take minimizing the Canvas3D frame to get the JMenu JFrame to not have the same issue. Maybe use JDesktop to handle the multiple JFrames, though that might end up having the same problem that 2 separate JFrames maybe has. – EGHM Jul 02 '13 at 03:58
  • So I fiddled around and got the Canvas to add to the JPanel, but the issue persists -- the dropdown menu is still hidden behind. – pyrrhic Jul 02 '13 at 04:04
  • Ugh, that's a bummer. I'ld try using two JFrames. One for the JMenu the other for Canvas3D. – EGHM Jul 02 '13 at 04:11
  • Okay, I'll try the separate JFrame method. Just for reference, the way the menubar is being added is setJMenuBar(mb)... Not sure if that makes a difference. This is strange, because in the 3D Viewer plug-in that comes with Fiji, the dropdown menu options show up fine on the Canvas. – pyrrhic Jul 02 '13 at 04:21
  • Does it include source code? Might be able to shoehorn your stuff into that code if you know it works. – EGHM Jul 02 '13 at 04:23