import javax.swing.*;
import java.awt.event.*;
class Win extends JFrame implements ActionListener
{
    JTable jTable1;
    JButton jButton1;
    Object a[][];
    JScrollPane jScrollPane1;
    public Win()
    {
        getContentPane().setLayout(null);
        setTitle("Ӧ");
        String name[] = {"", "Ӣɼ", "ѧɼ", "ܳɼ"};
        a = new Object[10][4];
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                if (j != 0)
                {
                	a[i][j] = "0";
                }
                else
                {
                	a[i][j] = "";
                }
            }
        }
        jButton1 = new JButton("ܳɼ");
        jScrollPane1 = new JScrollPane();
        jTable1 = new JTable(a, name);
        jButton1.setBounds(110, 173, 151, 34);
        jScrollPane1.setBounds(36, 13, 310, 153);
        add(jScrollPane1);
        add(jButton1);
        jScrollPane1.getViewport().add(jTable1);
        jButton1.addActionListener(this);
        setBounds(200, 300, 400, 240);
        setVisible(true);
        validate();
    }
    public void actionPerformed(ActionEvent e)
    {
        for (int i = 0; i < 10; i++)
        {
            double sum = 0;
            boolean boo = true;
            for (int j = 1; j <= 2; j++)
            {
                try{
                    sum = sum + Double.parseDouble(a[i][j].toString());
                } 
                catch (Exception ee)
                {
                    boo = false;
                    jTable1.repaint();
                }
                if (boo == true)
                {
                    a[i][3] = "" + sum;
                    jTable1.repaint();
                }
            }
        }
    }
}
public class JTable_test
{
    public static void main(String args[])
    {
      Win ta = new Win();
    }
}
