Solved

some lines compile some don't

Posted on 2006-11-03
2
190 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
[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
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

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

Suggested Solutions

Title # Comments Views Activity
hibernate jars 4 61
hibernate example for saving data 19 80
by zero exception 10 70
jsp insert to database example 2 66
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

730 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