Java gui 제곱 계산 프로그램

예외처리는 되어있지 않습니다.

package tue160531; 
 
import javax.swing.*; 
import java.awt.event.ActionEvent; 
import java.awt.event.ActionListener; 
 
/** 
 * Created on 2016-05-31. 
 */ 
public class dual extends JFrame { 
    private JPanel panel; 
    private JLabel label1; 
    private JLabel label2; 
    private JTextField tf1; 
    private JTextField tf2; 
    private JButton button; 
    private dual() { 
        this.setSize(300,200); 
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
        this.setTitle("제곱 계산하기"); 
         
        panel = new JPanel(); 
        label1 = new JLabel("숫자 입력:"); 
        tf1 = new JTextField(15); 
        label2 = new JLabel("제곱한 값:"); 
        tf2 = new JTextField(15); 
        button = new JButton("OK"); 
 
        tf2.setEditable(false); 
        panel.add(label1); 
        panel.add(tf1); 
        panel.add(label2); 
        panel.add(tf2); 
 
        button.addActionListener(new ActionListener() { 
            @Override 
            public void actionPerformed(ActionEvent e) { 
                if(e.getSource() == button) { 
                    int value = Integer.parseInt(tf1.getText()); 
                    tf2.setText(Integer.toString(value*value)); 
                } 
            } 
        }); 
        panel.add(button); 
 
        this.add(panel); 
        this.setVisible(true); 
 
    } 
 
    public static void main(String[] args) { 
        new dual(); 
    } 
}