I'm creating JPopUpMenu with following code:
JPopupMenu popup1 = new JPopupMenu();
JPopupMenu popup2 = new JPopupMenu();
JMenuItem freeze = new JMenuItem("freeze");
freeze.addActionListener(new FreezActionListener(this));
JMenuItem unfreeze = new JMenuItem("unfreeze");
unfreeze.addActionListener(new UnFreezActionListener(this));
JMenuItem sortU = new JMenuItem("sort");
JMenuItem sortD = new JMenuItem("sort");
popup1.add(freeze);
popup1.add(unfreeze);
popup1.add(sortU);
popup2.add(freeze);
popup2.add(unfreeze);
popup2.add(sortD);
After executing this code, popup2 menu works fine but popup1 has only sortU item.
If I add menu items first to popup2 and then to popup1, then popup1 works fine and popup2 doesn't.
Is it normal behavior or did I miss something ?
I've searched about this but can't find anything