Here you can find the source of getTheMenuBar(String[][] arr)
public static JMenuBar getTheMenuBar(String[][] arr)
//package com.java2s; //License from project: LGPL import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; public class Main { public static JMenuBar getTheMenuBar(String[][] arr) { JMenuBar jmb = new JMenuBar(); JMenu jm;// w w w . j a v a 2s.com JMenuItem jmi; for (int i = 0; i < arr.length; i++) { jm = new JMenu(arr[i][0]); for (int j = 1; j < arr[i].length; j++) { jmi = new JMenuItem(arr[i][j]); jm.add(jmi); } jmb.add(jm); } return jmb; } }