sorry, I fixed it.
EDIT:I've been thinking about the last part with the actionlistener, and I've revised it a bit, but it still doesn't work:
The only problem I can see with this is that
a) I can't use the boolian variable anyway because it says:"addStart cannot be resolved to a variable."
and
b)Even if it did work, The program would have to restart each time you want to add numbers.
EDITx2: I have trimmed out the button, there are no error messages on eclipse anymore. The only problem is that it still doesn't work. I think the proble might be that sumField is not updateing, but I know basically nothing about java, so I'll just post the code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Stuff {
public static void main(String[] args) {
// TODO Auto-generated method stub
//Make all of the objects.
JLabel enterFirst = new JLabel("First Number:");
JLabel enterSecond = new JLabel("+ Second Number");
JTextField firstNum = new JTextField("0", 5);
JTextField secondNum = new JTextField("0", 5);
JTextField sumField = new JTextField("0", 10);
//set dimensions for them if you don't want to do them by hand.
Dimension size1 = enterFirst.getPreferredSize();
Dimension size2 = enterSecond.getPreferredSize();
Dimension size3 = firstNum.getPreferredSize();
Dimension size4 = secondNum.getPreferredSize();
Dimension size6 = sumField.getPreferredSize();
//Make a JFrame.
JFrame x = new JFrame();
x.setLayout(null);
x.setVisible(true);
x.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
x.setSize(600,350);
x.setTitle("Calculator");
x.setBackground(Color.GRAY);
//Add the objects.
x.add(enterFirst);
x.add(firstNum);
x.add(enterSecond);
x.add(secondNum);
x.add(sumField);
//Set the objects positions.
enterFirst.setBounds(100, 20, size1.width, size1.height);
enterSecond.setBounds(300, 20, size2.width, size2.height);
firstNum.setBounds(200, 20, size3.width, size3.height);
secondNum.setBounds(420, 20, size4.width, size4.height);
sumField.setBounds(320, 45, size6.width, size6.height);
//Set the sumField to be uneditable.
sumField.setEditable(false);
String sumNum = new String("");
int sum = Integer.valueOf(firstNum.getText()) + Integer.valueOf(secondNum.getText());
sumNum = Integer.toString(sum);
sumField.setText(sumNum);
}
}