Results 1 to 2 of 2
Thread: please help, so many errors..
- 03-16-2011, 12:16 PM #1
Member
- Join Date
- Mar 2011
- Posts
- 1
- Rep Power
- 0
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...
- 03-16-2011, 12:26 PM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Similar Threads
-
First Java Program-Compile Errors (errors are posted)-simple GUI
By cc11rocks in forum AWT / SwingReplies: 4Last Post: 01-04-2011, 12:36 AM -
errors
By santosh chauhan in forum New To JavaReplies: 5Last Post: 07-26-2010, 07:59 PM -
Errors,errors and errors
By xpatiencex in forum New To JavaReplies: 6Last Post: 04-25-2009, 04:43 AM -
Errors.
By rocky in forum New To JavaReplies: 4Last Post: 04-09-2009, 08:05 AM -
What is the difference between Semantic Errors and Logical Errors?
By tlau3128 in forum New To JavaReplies: 3Last Post: 03-08-2009, 01:51 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks