Results 1 to 2 of 2
  1. #1
    mhel_14 is offline Member
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Default please help, so many errors..

    import java.awt.Component;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.GridLayout.*;

    public class examProj {
    private JFrame frame;
    private JLabel label1,label2,label3;
    private JTextField fNum,sNum,total;
    private JButton compute,exit;

    public examProj(){
    frame=new JFrame("Simple Calculator");
    label1=new JLabel("First Number");
    label2=new JLabel("Second Number");
    label3=new JLabel("Total");
    fNum=new JTextField();
    sNum=new JTextField();
    compute=new JButton("Compute");
    exit=new JButton("Exit");
    }
    public launch Frame(){
    frame=setLayout(new GridLayout(4.4)); //cannot find symbol error
    frame.add(label1);
    frame.add(label2);
    frame.add(label3);
    frame.add(total);
    compute.addActionListener(computeTotal()); //'void' type not allowed here
    frame.add(compute);
    exit.addActionListener(exitWindows());//cannot find symbol
    frame.add(exit);
    frame.pack();
    frame.visible(true);//cannot find symbol
    return Frame();


    }
    public void computeTotal(){
    public void actionPerformed(ActionEvent e){ //illegal start of expression
    int number1=Integer.parseInt(fNum.getText());
    int number2=Integer.parseInt(sNum.getText());
    int ttl=number1+number2;
    total.setText(ttl+"");
    }
    }
    public void exitWindows(){ //class,interface or enum expected
    public void actionPerformed(ActionEvent e){ //class,interface or enum expected
    System.exit(0);
    }
    }


    }


    please help...

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    10

    Default

    What errors did you get? What is your exact question? What do you think is wrong? What have you tried to do to fix it?

    Please use code tags

    [code ]
    your code here
    [/code]

Similar Threads

  1. Replies: 4
    Last Post: 01-04-2011, 01:36 AM
  2. errors
    By santosh chauhan in forum New To Java
    Replies: 5
    Last Post: 07-26-2010, 07:59 PM
  3. Errors,errors and errors
    By xpatiencex in forum New To Java
    Replies: 6
    Last Post: 04-25-2009, 04:43 AM
  4. Errors.
    By rocky in forum New To Java
    Replies: 4
    Last Post: 04-09-2009, 08:05 AM
  5. Replies: 3
    Last Post: 03-08-2009, 02:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •