import java.awt.Event.*;
import javax.swing.*;
public class Somma {
public static void main(String[] args) {
JFrame frame = new JFrame();
JTextField t1 = new JTextField();
JTextField t2 = new JTextField();
JButton button = new JButton("Vai!");
JTextField t3 = new JTextField();
button.addActionListener(new ButtonListener());
frame.setLayout(new GridLayout(4,1));
frame.setBounds(new Rectangle(300,300,320,450));
frame.add(t1);
frame.add(t2);
frame.add(button);
frame.add(t3);
frame.setVisible(true);
}
class ButtonListener {
public void actionPerformed(ActionEvent e) {
t3.setText(Integer.toString(Integer.parseInt(t1.getText())+Integer.parseInt(t1.getText())));
}
}
}