java 里的JTable问题
publicclassRextendsJFrame{JTabletj=null;JScrollPanejsp=null;JTablejt=null;//查APIrowDa...
public class R extends JFrame {
JTable tj = null;
JScrollPane jsp = null;
JTable jt = null;
// 查API rowData要求的是Vector数据
Vector rowData = null;
Vector columnNames = null;
public R (){
columnNames = new Vector();
columnNames.add("学号");
rowData = new Vector();
Vector row= new Vector();
row.add( 1001);
rowData.add(row);
jt=new JTable(rowData,columnNames);
this.add(jt);
this.setSize(500,200 );
this.setVisible(true);
this.setLocationRelativeTo(null);
this.setResizable(false);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setBackground(Color.red);
}
public static void main(String[] args) {
new R();
}
}
为什么没有列名显示啊 展开
JTable tj = null;
JScrollPane jsp = null;
JTable jt = null;
// 查API rowData要求的是Vector数据
Vector rowData = null;
Vector columnNames = null;
public R (){
columnNames = new Vector();
columnNames.add("学号");
rowData = new Vector();
Vector row= new Vector();
row.add( 1001);
rowData.add(row);
jt=new JTable(rowData,columnNames);
this.add(jt);
this.setSize(500,200 );
this.setVisible(true);
this.setLocationRelativeTo(null);
this.setResizable(false);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setBackground(Color.red);
}
public static void main(String[] args) {
new R();
}
}
为什么没有列名显示啊 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询