Link to home
Start Free TrialLog in
Avatar of charliebaby
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(ActionEvent e) {
//////     }
//////   });  

       FlowLayout layout7 = new FlowLayout(FlowLayout.CENTER);
          File7.setLayout(layout7);
               menuBar = new JMenuBar();
           JMenu menu = new JMenu("Menu");
               JMenuItem item = new JMenuItem("Item Label");
            setJMenuBar(menuBar);
                    ////////////////////////////  item.addActionListener(actionListener);
                   File7.add(menu);
                   menu.add(item);
            pane.add(File7);
      setVisible(true);
Avatar of charliebaby
charliebaby

ASKER

I'm really grasping at straws, cannot find the combonation that activates the menu select  fuction("item label"), anything would be a help.
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So were exactualy should I place ,item.addActionListener(actionListener);


FlowLayout layout7 = new FlowLayout(FlowLayout.CENTER);
          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(ActionEvent e) {
  }
});  
setVisible(true);
     }
yes thats fine
Yes it is only that I cannot get,  item.addActionListener(actionListener); , to compile is there some thing wrong with it?
yes, you don't define the var actionListener anywhere
var ActionListener=java.awt.event.ActionListener; how do I define this and do I have to add "var" to  item.add varActionListener(actionListener); 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
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.