//mnuName is not an array, but mnuTmpName is...mnuBar.add(mnuName [mnuCount]= new Menu(mnuTmpName));//try...mnuBar.add(mnuName = new Menu(mnuTmpName[mnuCount]));