0

I have a JPopupMenu lets call it (aaa) inside it i have Jmenu(mmm) ,contain some JmenuItems(like b,c,d,k). this popup menu shows at right click on the panel ,and on mouse over mmm menu the sub menu (b,c,d,k) appear ,but if i goes down a little bit under the mmm menu ,the sub menu (b,c,d,k) disappear ,how i can solve this to be more friendly ?can i make the sub menu (b,c,d,k) appear with left mouse click over the mmm menu?

JPopupMenu aaa = new JPopupMenu();
JMenu mmm = new JMenu("mmm");
JMenuItem b = new JMenuItem("b");
JMenuItem c = new JMenuItem("c");
JMenuItem d = new JMenuItem("d");
JMenuItem k = new JMenuItem("k");
mmm.add(b);
mmm.add(c);
mmm.add(d);
mmm.add(k);
aaa.add(mmm);
ama
  • 371
  • 4
  • 13
  • 2
    An [sscce](http://sscce.org/) might help clarify your question. – trashgod Jul 04 '11 at 16:31
  • could you reproduce your problem based on this example ??? http://stackoverflow.com/questions/6574400/having-gradient-background-of-system-tray-context-menu/6574557#6574557, edit yout post and shows ... – mKorbel Jul 05 '11 at 14:18

1 Answers1

0

Not able to reproduce your problem. This is what I have tried:

    JFrame frame = new JFrame();
    frame.setSize(300,300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    JPopupMenu aaa = new JPopupMenu();
    JMenu mmm = new JMenu("mmm");
    JMenuItem b = new JMenuItem("b");
    JMenuItem c = new JMenuItem("c");
    JMenuItem d = new JMenuItem("d");
    JMenuItem k = new JMenuItem("k");
    mmm.add(b);
    mmm.add(c);
    mmm.add(d);
    mmm.add(k);
    aaa.add(mmm);
    panel.setComponentPopupMenu(aaa);
    frame.add(panel);
    frame.setVisible(true);

Nothing gets disappears. Is this the same you are doing?

Harry Joy
  • 58,650
  • 30
  • 162
  • 207