> Hello,
>
[quoted text clipped - 7 lines]
>
> Thanks.
Good question! I would have a higher level JMenu like the following
JMenuPower. Just throw in the JMenuItem object to it and it will take
care of the rest.
//Now JMenu looks "primitive" and JMenuPower is relatively higher level
public class JMenuPower extends JMenu
{
public JMenuPower(String s)
{
super(s);
}
void addMenuItemAndListener(JMenuItem mi, ActionListener al)
{
mi.addActionListener(al);
this.add(mi);
}
}
To use it:
<code>
public class MemoGUI extends JFrame implements ActionListener
{
....
JMenuPower memoMenu = new JMenuPower("Memos"); //my own
JMenuPower class
JMenuItem m;
m = new JMenuItem("JMenuItem1");
memoMenu.addMenuItemAndListener(m, this);
m = new JMenuItem("JMenuItem2");
memoMenu.addMenuItemAndListener(m, this);
</code>