public static JMenu findMenu(JMenuBar bar, Class<? extends JMenu> type) {
		if (bar != null) {
			int count = bar.getMenuCount();
			for (int i = 0; i < count; i++) {
				JMenu menu = bar.getMenu(i);
				if (type.isInstance(menu)) {
					return menu;
				}
			}
		}
		return null;
	}