Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java GUI 设计  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
话题被移动
该话题已被移动 - floater , 2004-05-23 09:54
如果您尚不清楚该话题被移动的原因,请参考论坛规则以及本版公告或者联系本版版主。
作者 Re:求助有关JTable [Re:Dracula]
sc33



版主


发贴: 128
积分: 30
于 2004-05-21 11:43 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

import javax.swing.table.AbstractTableModel;

public class ChangeToTableModel extends AbstractTableModel {
private String[][] data = null;

public ChangeToTableModel(String[][] data) {
this.data = data;
}

public String getColumnName(int column) {
if (data != null) {
return data[0][column];
}
else {
return "";
}
}

public int getRowCount() {
if(data!=null) {
return data.length-1;
}
else {
return 0;
}
}

public int getColumnCount() {
if(data!=null) {
return data[0].length;
}
else {
return 0;
}
}

public Object getValueAt(int row, int column) {
if(data!=null) {
return data[row+1][column];
}
else {
return null;
}
}

}

必须实现:
getColumnCount()
getColumnName()
getValueAt(int row, int column)
三个抽象方法.

再有问题请到GUI论坛提问!




话题树型展开
人气 标题 作者 字数 发贴时间
4325 求助有关JTable Dracula 212 2004-05-16 22:49
3615 Re:求助有关JTable tangming 57 2004-05-17 09:15
3294 Re:求助有关JTable Dracula 60 2004-05-17 10:53
3605 Re:求助有关JTable sc33 925 2004-05-21 11:43
3668 Re:求助有关JTable Dracula 15 2004-05-21 22:30

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923