charliebaby
asked on
item label components
can someone show me how to format the the item label components
//////// item.addActionListener(new ActionListener() {
///// public void actionPerformed(ActionEven t e) {
////// }
////// });
FlowLayout layout7 = new FlowLayout(FlowLayout.CENT ER);
File7.setLayout(layout7);
menuBar = new JMenuBar();
JMenu menu = new JMenu("Menu");
JMenuItem item = new JMenuItem("Item Label");
setJMenuBar(menuBar);
////////////////////////// // item.addActionListener(act ionListene r);
File7.add(menu);
menu.add(item);
pane.add(File7);
setVisible(true);
//////// item.addActionListener(new
///// public void actionPerformed(ActionEven
////// }
////// });
FlowLayout layout7 = new FlowLayout(FlowLayout.CENT
File7.setLayout(layout7);
menuBar = new JMenuBar();
JMenu menu = new JMenu("Menu");
JMenuItem item = new JMenuItem("Item Label");
setJMenuBar(menuBar);
//////////////////////////
File7.add(menu);
menu.add(item);
pane.add(File7);
setVisible(true);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
So were exactualy should I place ,item.addActionListener(ac tionListen er);
FlowLayout layout7 = new FlowLayout(FlowLayout.CENT ER);
File7.setLayout(layout7);
menuBar = new JMenuBar();
JMenu menu = new JMenu("Menu");
JMenuItem item = new JMenuItem("Item Label");
setJMenuBar(menuBar);
File7.add(item);
File7.add(menu);
menu.add(item);
pane.add(File7);
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEven t e) {
}
});
setVisible(true);
}
FlowLayout layout7 = new FlowLayout(FlowLayout.CENT
File7.setLayout(layout7);
menuBar = new JMenuBar();
JMenu menu = new JMenu("Menu");
JMenuItem item = new JMenuItem("Item Label");
setJMenuBar(menuBar);
File7.add(item);
File7.add(menu);
menu.add(item);
pane.add(File7);
item.addActionListener(new
public void actionPerformed(ActionEven
}
});
setVisible(true);
}
yes thats fine
ASKER
Yes it is only that I cannot get, item.addActionListener(act ionListene r); , to compile is there some thing wrong with it?
yes, you don't define the var actionListener anywhere
ASKER
var ActionListener=java.awt.ev ent.Action Listener; how do I define this and do I have to add "var" to item.add varActionListener(actionLi stener); I am so confused please spell it out for me and I will close out the question, Thank you
you don't need that line, it can be replaced with what i posted above
ASKER
well I did what you say, so I will close the question like I said I would, however JMenuItem item = new JMenuItem("Item Label"); I don't see the menu chioce.
ASKER