JMenu setPopupMenuVisible not working?
843806Nov 1 2007 — edited Nov 2 2007Hello everyone,
I am trying to hide the popup menu of a JMenu on a JFrame but setPopupMenuVisible(false) seems not to work.
Maybe I haven't got the true meaning of this function. This is the code, nothing special:
jMenuBar = new javax.swing.JMenuBar();
jMenu = new javax.swing.JMenu();
jMenuItem = new javax.swing.JMenuItem();
jMenuItem.setText("Item");
jMenu.setText("Menu");
jMenu.setPopupMenuVisible(false);
jMenu.add(jMenuItem);
jMenuBar.add(jMenu);
setJMenuBar(jMenuBar);
The thing is, with an empty JMenu, there is a small grey area under the JMenu-button still showing. That is very annoying. I am using JDK 1.6.
The only workaround that I have found is this:
jMenu.getPopupMenu().setPopupSize(0,0);
Is this a bug or something normal? What about that little grey area?