Q:

JButton and GUI freezes after click

When Eclipse compiles this code everything works fine except the GUI freezes after the user clicks the "add" button.  The answer is displayed and the work is shown.  Can anyone shine some light on this problem and maybe give me some advice for the layout as well? 
import Aritmathic. MathEquation;

public class GUI extends JFrame implements ActionListener{
    private JTextField field1;
    private JTextField field2;
    private JButton add, subtract, multiply, divide;
    private JLabel lanswer, label1, label2;
    private String input1, input2, sanswer;
    private int answer = 0;

    JPanel contentPanel, answerPanel;

    public GUI(){
        super("Calculator");

        field1 = new JTextField(null, 15);
        field2 = new JTextField(null, 15);

        add = new JButton("add");
        subtract = new JButton("subtract");
        multiply = new JButton("multiply");
        divide = new JButton("divide");

        lanswer = new JLabel("", SwingConstants. CENTER);
        label1 = new JLabel("Value 1:");
        label2 = new JLabel("Value 2:");

        add.addActionListener(this);

        Dimension opSize = new Dimension(110, 20);
        Dimension inSize = new Dimension(200, 20);

        lanswer.setPreferredSize(new Dimension(200,255));

        field1.setPreferredSize(inSize);
        field2.setPreferredSize(inSize);
        add.setPreferredSize(opSize);
        subtract.setPreferredSize(opSize);
        multiply.setPreferredSize(opSize);
        divide.setPreferredSize(opSize);

        contentPanel = new JPanel();
        contentPanel.setBackground(Color. PINK);
        contentPanel.setLayout(new FlowLayout());

        answerPanel = new JPanel();
        answerPanel.setPreferredSize(new Dimension(230, 260));
        answerPanel.setBackground(Color. WHITE);
        answerPanel.setLayout(new BoxLayout(answerPanel, BoxLayout. Y_AXIS));

        contentPanel.add(answerPanel);
        contentPanel.add(label1); contentPanel.add(field1); 
        contentPanel.add(label2); contentPanel.add(field2);
        contentPanel.add(add); contentPanel.add(subtract); contentPanel.add(multiply); contentPanel.add(divide);

        this.setContentPane(contentPanel);
    }

    public void actionPerformed(ActionEvent e) {
        JButton src = (JButton)e.getSource();

        if(src.equals(add)){
            add();
        } 
    }

    private void add(){
        input1 = field1.getText();
        input2 = field2.getText();

        MathEquation problem = new MathEquation(input1, input2);

        Dimension lineSize = new Dimension(10, 10);

        JPanel line1 = new JPanel(); line1.setBackground(Color. WHITE); 
        JPanel line2 = new JPanel(); line2.setBackground(Color. WHITE); 
        JPanel line3 = new JPanel(); line3.setBackground(Color. WHITE); 
        JPanel line4 = new JPanel(); line4.setBackground(Color. WHITE); 
        JPanel line5 = new JPanel(); line4.setBackground(Color. WHITE); 

        JLabel[] sumLabels = problem.getSumLabels();
        JLabel[] addend1Labels = problem.getAddend1Labels();
        JLabel[] addend2Labels = problem.getAddend2Labels();
        JLabel[] carriedLabels = problem.getCarriedLabels();

        for(int i = 0; i < carriedLabels.length; i++){
            line1.add(carriedLabels[i]);
        }

        for(int i = 0; i < addend1Labels.length; i++){
            line2.add(addend1Labels[i]);
        }

        for(int i = 0; i < addend2Labels.length; i++){
            line3.add(addend2Labels[i]);
        }

        String answerLine = "__";

        for(int i = 0; i < sumLabels.length; i++){
            answerLine += "__";
        }

        line4.add(new JLabel(answerLine));

        for(int i = 0; i < sumLabels.length; i++){
            line5.add(sumLabels[i]);
        }

        answerPanel.add(new JLabel(" "));
        answerPanel.add(new JLabel(" "));
        answerPanel.add(new JLabel(" "));
        answerPanel.add(new JLabel(" "));
        answerPanel.add(line1);
        answerPanel.add(line1);
        answerPanel.add(line2);
        answerPanel.add(line3);
        answerPanel.add(line4);
        answerPanel.add(line5);
        answerPanel.add(new JLabel(" "));
        answerPanel.add(new JLabel(" "));
        answerPanel.add(new JLabel(" "));
        answerPanel.add(new JLabel(" "));

        this.setContentPane(answerPanel);
    }
}

A:

You have to revalidate your JFrame after you change the content pane. 
After 
this.setContentPane(answerPanel);

add
revalidate();

Java docs about revalidate()
Your add() method should now look like:
private void add(){
    input1 = field1.getText();
    input2 = field2.getText();

    MathEquation problem = new MathEquation(input1, input2);

    Dimension lineSize = new Dimension(10, 10);

    JPanel line1 = new JPanel(); line1.setBackground(Color. WHITE); 
    JPanel line2 = new JPanel(); line2.setBackground(Color. WHITE); 
    JPanel line3 = new JPanel(); line3.setBackground(Color. WHITE); 
    JPanel line4 = new JPanel(); line4.setBackground(Color. WHITE); 
    JPanel line5 = new JPanel(); line4.setBackground(Color. WHITE); 

    JLabel[] sumLabels = problem.getSumLabels();
    JLabel[] addend1Labels = problem.getAddend1Labels();
    JLabel[] addend2Labels = problem.getAddend2Labels();
    JLabel[] carriedLabels = problem.getCarriedLabels();

    for(int i = 0; i < carriedLabels.length; i++){
        line1.add(carriedLabels[i]);
    }

    for(int i = 0; i < addend1Labels.length; i++){
        line2.add(addend1Labels[i]);
    }

    for(int i = 0; i < addend2Labels.length; i++){
        line3.add(addend2Labels[i]);
    }

    String answerLine = "__";

    for(int i = 0; i < sumLabels.length; i++){
        answerLine += "__";
    }

    line4.add(new JLabel(answerLine));

    for(int i = 0; i < sumLabels.length; i++){
        line5.add(sumLabels[i]);
    }

    answerPanel.add(new JLabel(" "));
    answerPanel.add(new JLabel(" "));
    answerPanel.add(new JLabel(" "));
    answerPanel.add(new JLabel(" "));
    answerPanel.add(line1);
    answerPanel.add(line1);
    answerPanel.add(line2);
    answerPanel.add(line3);
    answerPanel.add(line4);
    answerPanel.add(line5);
    answerPanel.add(new JLabel(" "));
    answerPanel.add(new JLabel(" "));
    answerPanel.add(new JLabel(" "));
    answerPanel.add(new JLabel(" "));

    this.setContentPane(answerPanel);
    this.revalidate();//

    }

When I tested this it works.   By works I mean did not freeze and set the content pane to the answerPanel.