The Artima Developer Community
Sponsored Link

Java Answers Forum
MenuBar help!!!

1 reply on 1 page. Most recent reply: Jul 24, 2003 9:58 PM by Greg Lehane

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
sriram

Posts: 11
Nickname: scorpkris
Registered: Jul, 2003

MenuBar help!!! Posted: Jul 24, 2003 9:32 PM
Reply to this message Reply
Advertisement
well, iam a novice programmer as far as java is concerned. can u plz help me with this:

//iam creating a menu bar
MenuBar mnubr=new MenuBar();
setMenuBar(mnubr);

but, this doesnt work. it gives an error at setMenuBar(mnubr); with a ^ under s.

plz reply.

thanx


Greg Lehane

Posts: 33
Nickname: glehane
Registered: Jun, 2003

Re: MenuBar help!!! Posted: Jul 24, 2003 9:58 PM
Reply to this message Reply
Is your class extending JFrame?

If not, you will need to say which frame you wish to attach the menubar to. i.e.
JMenuBar mb = new JMenuBar();
JFrame f = new JFrame();
f.setJMenuBar(mb);


Stating "setJMenuBar()" on its own would imply that you are in a subclass of JFrame. i.e.
public class MyFrame extends JFrame {
  .
  .
  void someMethod() {
    JMenuBar mb = new JMenuBar();
    this.setJMenuBar(mb);
  }
  .
  .  
}  



=- Greg

Flat View: This topic has 1 reply on 1 page
Topic: Issues in Java browser Previous Topic   Next Topic Topic: Dynamic Panel

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use