/** * Method declaration * * @param s */ private void addToRecent(String s) { for (int i = 0; i < iMaxRecent; i++) { if (s.equals(sRecent[i])) { return; } } if (sRecent[iRecent] != null) { mRecent.remove(iRecent); } sRecent[iRecent] = s; if (s.length() > 43) { s = s.substring(0, 40) + "..."; } MenuItem item = new MenuItem(s); item.setActionCommand("#" + iRecent); item.addActionListener(this); mRecent.insert(item, iRecent); iRecent = (iRecent + 1) % iMaxRecent; }
/** * Method declaration * * @param f * @param m */ void addMenuItems(Menu f, String m[]) { for (int i = 0; i < m.length; i++) { MenuItem item = new MenuItem(m[i].substring(1)); char c = m[i].charAt(0); if (c != '-') { item.setShortcut(new MenuShortcut(c)); } item.addActionListener(this); f.add(item); } }