Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: What is Wrong with my Code? I m new To Java But i have Done this before Months ago

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default What is Wrong with my Code? I m new To Java But i have Done this before Months ago

    What thing i m missing? UnderLine my Errors it as 38 Errors but i don't see any big error

    import java.awt.*;
    import javax.swing.*;
    Class Draw
    {
    public Draw()
    {
    JFrame frm= new JFrame("Example");
    Container con = frm.getContentPane();
    con.setLayout(new GridLayout(2,2));
    MenuBar mb= new MenuBar();
    Menu m1= new Menu("File");
    Menu m2= new Menu("Edit");
    Menu m3= new Menu("Format");
    Menu m4= new Menu("Help");
    MenuItem mi1= new MenuItem("New");
    MenuItem mi11= new MenuItem("close");
    MenuItem mi2= new MenuItem("Save");
    MenuItemm mi3= new MenuItem("Save As");
    MenuItem mi4= new MenuItem("Edit");
    MenuItem mi5= new MenuItem("EXIT")
    MenuItem mi6= new MenuItem("Find");
    MenuItem mi7= new MenuItem("Bold")
    MenuItem mi8= new MenuItem("Italic")
    MenuItem mi9= new MenuItem("Replace")
    MenuItem mi10= new MenuItem("Online Help");
    m1.add(mi1); m1.add(mi2) m1.add(mi11); m1.add(mi3); m1.add(mi4);
    m2.add(mi6);m2.add(mi7); m2.add(mi8);
    m3.add(mi9);
    m4.add(mi10); m4.add(mi5);
     
    mb.add(m1);	mb.add(m2);	mb.add(m3);
    	mb.add(m4);
     
    frm.SetMenubar(mb);
    JButton btn1= new JButton("check");
    JButton btn2= new JButton("Balance");
    JButton btn3= new JButton("Funds");
    JButton btn4 = new JButton("Exit");
    con.add(btn1);con.add(btn2);con.add(btn3);con.add(btn4);
    frm.setVisible(true);
    frm.setSize(300,300);
    frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
    }
     
    public class D45
    {
    public static void main(String s [])
    {
    Draw obj=new Draw();
    }
    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: What is Wrong with my Code? I m new To Java But i have Done this before Months ag

    Please copy the full text of the error messages and paste them here.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: What is Wrong with my Code? I m new To Java But i have Done this before Months ag

    I second Norm's advice. Also you'll not want to mix Swing and AWT components. Convert all of the AWT components you have to their Swing counterparts. This won't fix your current compilation errors, but will fix errors to come.

Similar Threads

  1. What is wrong with my code? JAVA-Eclipse
    By bespinoz in forum Loops & Control Statements
    Replies: 9
    Last Post: November 17th, 2012, 04:06 PM
  2. What's wrong with my java code?
    By mjmz in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 17th, 2012, 10:06 PM
  3. Replies: 0
    Last Post: January 12th, 2012, 07:00 AM
  4. Replies: 10
    Last Post: April 5th, 2011, 09:09 AM
  5. [SOLVED] what is wrong for the java code
    By chuikingman in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 11th, 2010, 02:00 AM