快来找错呀
我想实现的功能是:从表单接收数据,然后调用jtable浏览刚才表单的内容,而jtable的构造方法中有一种是new jtable(object[][] o1,object[] o2),第一个参数是二维数组,用来存记录,第二个是一维数组,用来存字段,表单里的数据是不断填加的,所以二维数组应该是动态的,我用下面这个例子实现了动态二维数组,不过感觉麻烦,请高手指点在线恭候答案,谢谢!!此程序编译正常, "填加 "按钮正常,而 "浏览 "按钮就出错,怎么回事呢?
import java.awt.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class sunrg extends JFrame implements ActionListener
{
JTable jt;
String[] tableHead={ "姓名 ", "电话 ", "年龄 "};
Object [][] recorder;
JButton jb1;
JButton jb2;
JButton jb3;
JTextField[] jtf=new JTextField[3];
Vector v;
Vector v1;
JPanel jp;
public sunrg()
{
//final JFrame f=this;
//v1=new Vector();
//v1.addElement((JFrame)f);
v=new Vector();
setSize(300,300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container cp=getContentPane();
cp.setLayout(null);
//cp.setBounds(new Rectangle(100,100,300,300));
jp=new JPanel();
jp.setLayout(null);
jp.setBounds(new Rectangle(50,50,500,500));
JLabel jl=new JLabel( "信息采集表 ");
jl.setBounds(new Rectangle(90,20,100,50));
JLabel jl1=new JLabel( "姓名 ");
jl1.setBounds(new Rectangle(60,60,25,15));
jtf[0]=new JTextField( " ");
jtf[0].setBounds(new Rectangle(86,60,100,15));