[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

some lines compile some don't

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
charliebaby
Asked:
charliebaby
1 Solution
 
objectsCommented:
//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
 
charliebabyAuthor Commented:
Great, I am so beat, will put this to practice tomorrow and post new question as I progress, Thanks again
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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now