看,一个小例子。超简单。
import javax.swing.JFrame;
import javax.swing.JTable;
public class TestDriver extends JFrame{
private JTable table;
public TestDriver(String s){
super(s);
this.table = new JTable(5,5);
this.add(table);
this.pack();
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args){
TestDriver t = new TestDriver("这是一个表格");
}
}
温馨提示:答案为网友推荐,仅供参考