Bookmark Topic Watch Topic
  • New Topic

to make menu bar

 
mandeep singh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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();
}
}Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Mandeep>cd\

C:\>javac fj.java
fj.java:16: cannot resolve symbol
symbol : variable mEdit
location: class fj
mEdit=new JMenu("Edit");
^
fj.java:25: cannot resolve symbol
symbol : variable mEdit
location: class fj
mb.add(mEdit);
^
fj.java:28: cannot resolve symbol
symbol : variable mEdit
location: class fj
mEdit.add(mCopy);
^
fj.java:29: cannot resolve symbol
symbol : variable mEdit
location: class fj
mEdit.add(mPaste);
^
fj.java:32: cannot resolve symbol
symbol : method addSeperator ()
location: class javax.swing.JMenu
mFile.addSeperator();
^
5 errors

sorry friends i forgot to display the errors..
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Report post to moderator
> sorry friends i forgot to display the errors..

the answers remain the same (refer to your other post)
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Closing this thread - please refer to the other to continue this discussion.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!