Solved

item label components

Posted on 2006-11-04
9
184 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
Independent Software Vendors: 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!

 
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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
xampp tool 12 59
ejb example issues 3 53
Delphi Firemonkey: if the Sms contain special characters it won't send it 3 64
Java 8 to Java 6 8 33
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

749 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