Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

to make menu bar

 
mandeep singh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import javax.swing.*;
import java.awt.*;
public class fj
{
JFrame ff;
JMenuBar mb;
JMenu mFile,MEdit;
JMenuItem mNew,mClose,mCopy,mPaste;
JCheckBoxMenuItem mPrint;
JMenu mFont;
public fj()
{
ff=new JFrame("Yahoo.com");
mb=new JMenuBar();
mFile=new JMenu("File");
mEdit=new JMenu("Edit");
mNew=new JMenuItem("New");
mClose=new JMenuItem("Close");
mCopy=new JMenuItem("Copy");
mPaste=new JMenuItem("Paste");
mPrint=new JCheckBoxMenuItem("Print");
mFont=new JMenu("Font");
ff.setJMenuBar(mb);
mb.add(mFile);
mb.add(mEdit);
mFile.add(mNew);
mFile.add(mClose);
mEdit.add(mCopy);
mEdit.add(mPaste);
mClose.setEnabled(false);
mFile.add(mPrint);
mFile.addSeperator();
mFile.add(mFont);
mFont.add("Arial");
mFont.add("Times New Roman");
ff.setSize(400,400);
ff.setVisible(true);
}
public static void main(String args[])
{
fj f1=new fj();
}
}

dear friends this programme giving 5 errors..Help me please
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Help me please

read what the first error says, fix it, recompile - see if there's any more errors.
repeat above, if necessary.

hint: java is case-sensitive
 
Campbell Ritchie
Marshal
Posts: 52621
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use the code button underneath the message window when quoting code; it makes it easier to read. Please quote details of the error messages; those of us who are more experienced can tell from the messages what is going wrong. Have a look at these FAQs.

Welcome to JavaRanch

Michael Dunn has already given you a big hint about what the errors mean. In fact you have two errors, not five; one of them appears 4 times. Take Michael's hint about cases. Note the name of the variable it complains about, and go back to where you declared it.
You also need to be very careful about spelling. Look in the API documentation and check the exact spelling of the methods.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!