Solved

item label components

Posted on 2006-11-04
9
185 Views
Last Modified: 2010-03-31
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);
0
Comment
Question by:charliebaby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 

Author Comment

by:charliebaby
ID: 17874877
I'm really grasping at straws, cannot find the combonation that activates the menu select  fuction("item label"), anything would be a help.
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 17874910
item.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent event) {
       // this will get called
}});
0
 

Author Comment

by:charliebaby
ID: 17874942
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);
     }
0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
LVL 92

Expert Comment

by:objects
ID: 17875095
yes thats fine
0
 

Author Comment

by:charliebaby
ID: 17875155
Yes it is only that I cannot get,  item.addActionListener(actionListener); , to compile is there some thing wrong with it?
0
 
LVL 92

Expert Comment

by:objects
ID: 17875223
yes, you don't define the var actionListener anywhere
0
 

Author Comment

by:charliebaby
ID: 17875243
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
0
 
LVL 92

Expert Comment

by:objects
ID: 17875338
you don't need that line, it can be replaced with what i posted above
0
 

Author Comment

by:charliebaby
ID: 17876616
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question