Here you can find the source of createMenuBar(JMenu... menues)
static JMenuBar createMenuBar(JMenu... menues)
//package com.java2s; /*/*from w w w . j a va 2s . com*/ Formulae - Free Expressions Copyright (C) Laurence R. Ugalde - laurence@formulae.org formulae.org This file is part of Formulae front-end "Desktop". Formulae Desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Formulae Desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Formulae Desktop. If not, see <http://www.gnu.org/licenses/>. */ import javax.swing.JMenu; import javax.swing.JMenuBar; public class Main { static JMenuBar createMenuBar(JMenu... menues) { JMenuBar menuBar = new JMenuBar(); for (JMenu menu : menues) { menuBar.add(menu); } return menuBar; } }