java Swing中的 table 问题
这是 我编的一段嵌在标签中的表格代码 但是在编译后没有显现出表格,请高手们帮我看看
import javax.swing.*;
import javax.swing.table.*;
public class MyTable extends JInternalFrame{
public MyTable()
{
super();
TableModel tm = new AbstractTableModel()
{
String data[][]={
{"a","man","1234565","7b611","sheyuan"},
{"a","woman","1234565","7b611","sheyuan"}
} ;
String headers[]={"xingming","xingbie","telephone","adress","zhiwei"};
public int getColumnCount(){return headers.length;}
public int getRowCount(){return data.length; }
public String getColumnName(int col){return headers[col];}
public boolean isCellEditable(int row,int col)
{
return true;
}
public Object getValueAt(int row,int col)
{
return data[row][col];
}
public void setValueAt(Object value,int row,int col)
{
data[row][col]=(String)value;
fireTableRowsUpdated(row,row);
}
}; //end of TableModel
JTable jt =new JTable(tm);
JScrollPane js = new JScrollPane(jt);
setContentPane(js);
setSize(350,150);
setLocation(150,20);
} //end of MyTable
} //end of class MyTable