类实现actionListener(public class buttonpanel extends JFrame implements ActionListener)监听接口,就可以在actionPerformed方法中编辑点击后的处理。for (int i = 0; i < data.length; i++) {
    //e为actionPerformed传入的....Event参数。
    if (e.getSource().equal(jb1[i])) {
        //点击第i个确定按钮,jl[i]就是对应的label值。
    } else if (e.getSource().equal(jb2[i])) {
        //参考上一个注释。
    }
}
方法名称和类名称记得不是那么清楚了,你自己再查查。

解决方案 »

  1.   

    谢谢!本人已经解决了此问题!
    在for循环内加入:final j=i;
     jb1[i].addActionListener(new ActionListener()
                {                @Override
                    public void actionPerformed(ActionEvent e) {
                        // TODO Auto-generated method stub
                       System.out.println(jl[j].getText().trim());
                                           
                    }
                    
                    
                }
                        );