标题:java Swing中的 table 问题
取消只看楼主
玩火
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2006-12-17
 问题点数:0 回复次数:1 
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
搜索更多相关主题的帖子: quot java table Swing import 
2007-03-20 19:52
玩火
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2006-12-17
得分:0 
回复:(tblovecj)二楼的有道理

谢谢各位的帮忙!!!

2007-03-21 09:25



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-125414-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.133058 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved