Solved

some lines compile some don't

Posted on 2006-11-03
2
186 Views
Last Modified: 2010-03-31
below are snipets of my code. As you see I note that some lines compile some don't. what is wrong with the snippets that don't ? thanks



JMenuBar menuBar;//compiles must be right
 menuBar = new JMenuBar();// compiles must be right

JMenu menu = new JMenu("Menu Label");// compiles must be right
    menuBar.add(menu);// compiles must be right

 JMenuItem item = new JMenuItem("Item Label");// compiles must be right

 //frame.setJMenuBar(menuBar);//doesn't compile, what is wrong?  
//item.addActionListener(actionListener);//doesn't compile, what is wrong?

 menu.add(item); // compiles must be right

 // frame.setJMenuBar(menuBar);//doesn't compile, what is wrong?
0
Comment
Question by:charliebaby
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 17872206
//frame.setJMenuBar(menuBar);//doesn't compile, what is wrong?  

should be:

setJMenuBar(menuBar);

//item.addActionListener(actionListener);//doesn't compile, what is wrong?

actionListener is not defined
0
 

Author Comment

by:charliebaby
ID: 17872237
Great, I am so beat, will put this to practice tomorrow and post new question as I progress, Thanks again
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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…
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now