private void destroyMenu(JMenu menu) {
		if (menu == null)
			return;
		PopupMenuListener[] pml = menu.getPopupMenu().getPopupMenuListeners();
		if (pml != null) {
			for (PopupMenuListener x : pml)
				menu.getPopupMenu().removePopupMenuListener(x);
		}
		MenuListener[] ml = menu.getMenuListeners();
		if (ml != null) {
			for (MenuListener x : ml)
				menu.removeMenuListener(x);
		}
		Component c;
		for (int i = 0, n = menu.getComponentCount(); i < n; i++) {
			c = menu.getComponent(i);
			if (c instanceof JMenu) {
				destroyMenu((JMenu) c);
			}
			else if (c instanceof JMenuItem) {
				JMenuItem menuItem = (JMenuItem) c;
				menuItem.setAction(null);
				ActionListener[] al = menuItem.getActionListeners();
				if (al != null) {
					for (ActionListener x : al)
						menuItem.removeActionListener(x);
				}
				ItemListener[] il = menuItem.getItemListeners();
				if (il != null) {
					for (ItemListener x : il)
						menuItem.removeItemListener(x);
				}
			}
		}
		menu.removeAll();
	}