Here you can find the source of addIntoMenu(JMenu menu, JMenuItem[] menuItems)
public static void addIntoMenu(JMenu menu, JMenuItem[] menuItems)
//package com.java2s; /*// w w w . java 2s . c om * Copyright 2001-2008 Aqris Software AS. All rights reserved. * * This program is dual-licensed under both the Common Development * and Distribution License ("CDDL") and the GNU General Public * License ("GPL"). You may elect to use one or the other of these * licenses. */ import javax.swing.JMenu; import javax.swing.JMenuItem; public class Main { /** * Adds JMenuItems into specified JMenu. */ public static void addIntoMenu(JMenu menu, JMenuItem[] menuItems) { for (int i = 0; i < menuItems.length; i++) { menu.add(menuItems[i]); } } }