发布网友 发布时间:2022-04-24 04:00
共2个回答
热心网友 时间:2023-10-26 12:34
public static void main(String[] args) {
Student s1 = new Student("张三", "001", 0);
Student s2 = new Student("李四", "002", 1);
Student s3 = new Student("王五", "003", 0);
Vector<Object> row1 = new Vector<Object>();
row1.add(s1.getName());
row1.add(s1.getNumber());
row1.add(s1.getAbsentTimes());
Vector<Object> row2 = new Vector<Object>();
row2.add(s2.getName());
row2.add(s2.getNumber());
row2.add(s2.getAbsentTimes());
Vector<Vector<Object>> studentData = new Vector<Vector<Object>>();
Vector<String> columnNames = new Vector<String>();
studentData.add(row1);
studentData.add(row2);
columnNames.add("姓名");
columnNames.add("编号");
columnNames.add("缺考次数");
JTable table = new JTable(studentData, columnNames);
JFrame f = new JFrame();
JScrollPane scrollPane = new JScrollPane(table);
f.getContentPane().add(scrollPane, BorderLayout.CENTER);
f.setVisible(true);
f.setSize(500, 500);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
热心网友 时间:2023-10-26 12:34
Vector<Object> rows, columns;
JTable tabledisplay = null;
。。。
tabledisplay = new JTable (rows, columns);
tabModel = new DefaultTableModel ();
rows = new Vector<Object> ();
columns = new Vector<Object> ();
tabModel.setDataVector (rows, columns);
。。。
columns.addElement ("。。");
columns.addElement ("...");
...
Vector<Object> r = new Vector<Object> ();
r.addElement (j++);
...
rows.addElement (r);
..
tabledisplay.addNotify ();
热心网友 时间:2023-10-26 12:34
public static void main(String[] args) {
Student s1 = new Student("张三", "001", 0);
Student s2 = new Student("李四", "002", 1);
Student s3 = new Student("王五", "003", 0);
Vector<Object> row1 = new Vector<Object>();
row1.add(s1.getName());
row1.add(s1.getNumber());
row1.add(s1.getAbsentTimes());
Vector<Object> row2 = new Vector<Object>();
row2.add(s2.getName());
row2.add(s2.getNumber());
row2.add(s2.getAbsentTimes());
Vector<Vector<Object>> studentData = new Vector<Vector<Object>>();
Vector<String> columnNames = new Vector<String>();
studentData.add(row1);
studentData.add(row2);
columnNames.add("姓名");
columnNames.add("编号");
columnNames.add("缺考次数");
JTable table = new JTable(studentData, columnNames);
JFrame f = new JFrame();
JScrollPane scrollPane = new JScrollPane(table);
f.getContentPane().add(scrollPane, BorderLayout.CENTER);
f.setVisible(true);
f.setSize(500, 500);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
热心网友 时间:2023-10-26 12:35
Vector<Object> rows, columns;
JTable tabledisplay = null;
。。。
tabledisplay = new JTable (rows, columns);
tabModel = new DefaultTableModel ();
rows = new Vector<Object> ();
columns = new Vector<Object> ();
tabModel.setDataVector (rows, columns);
。。。
columns.addElement ("。。");
columns.addElement ("...");
...
Vector<Object> r = new Vector<Object> ();
r.addElement (j++);
...
rows.addElement (r);
..
tabledisplay.addNotify ();
热心网友 时间:2023-10-26 12:34
public static void main(String[] args) {
Student s1 = new Student("张三", "001", 0);
Student s2 = new Student("李四", "002", 1);
Student s3 = new Student("王五", "003", 0);
Vector<Object> row1 = new Vector<Object>();
row1.add(s1.getName());
row1.add(s1.getNumber());
row1.add(s1.getAbsentTimes());
Vector<Object> row2 = new Vector<Object>();
row2.add(s2.getName());
row2.add(s2.getNumber());
row2.add(s2.getAbsentTimes());
Vector<Vector<Object>> studentData = new Vector<Vector<Object>>();
Vector<String> columnNames = new Vector<String>();
studentData.add(row1);
studentData.add(row2);
columnNames.add("姓名");
columnNames.add("编号");
columnNames.add("缺考次数");
JTable table = new JTable(studentData, columnNames);
JFrame f = new JFrame();
JScrollPane scrollPane = new JScrollPane(table);
f.getContentPane().add(scrollPane, BorderLayout.CENTER);
f.setVisible(true);
f.setSize(500, 500);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
热心网友 时间:2023-10-26 12:35
Vector<Object> rows, columns;
JTable tabledisplay = null;
。。。
tabledisplay = new JTable (rows, columns);
tabModel = new DefaultTableModel ();
rows = new Vector<Object> ();
columns = new Vector<Object> ();
tabModel.setDataVector (rows, columns);
。。。
columns.addElement ("。。");
columns.addElement ("...");
...
Vector<Object> r = new Vector<Object> ();
r.addElement (j++);
...
rows.addElement (r);
..
tabledisplay.addNotify ();
热心网友 时间:2023-10-26 12:34
public static void main(String[] args) {
Student s1 = new Student("张三", "001", 0);
Student s2 = new Student("李四", "002", 1);
Student s3 = new Student("王五", "003", 0);
Vector<Object> row1 = new Vector<Object>();
row1.add(s1.getName());
row1.add(s1.getNumber());
row1.add(s1.getAbsentTimes());
Vector<Object> row2 = new Vector<Object>();
row2.add(s2.getName());
row2.add(s2.getNumber());
row2.add(s2.getAbsentTimes());
Vector<Vector<Object>> studentData = new Vector<Vector<Object>>();
Vector<String> columnNames = new Vector<String>();
studentData.add(row1);
studentData.add(row2);
columnNames.add("姓名");
columnNames.add("编号");
columnNames.add("缺考次数");
JTable table = new JTable(studentData, columnNames);
JFrame f = new JFrame();
JScrollPane scrollPane = new JScrollPane(table);
f.getContentPane().add(scrollPane, BorderLayout.CENTER);
f.setVisible(true);
f.setSize(500, 500);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
热心网友 时间:2023-10-26 12:34
public static void main(String[] args) {
Student s1 = new Student("张三", "001", 0);
Student s2 = new Student("李四", "002", 1);
Student s3 = new Student("王五", "003", 0);
Vector<Object> row1 = new Vector<Object>();
row1.add(s1.getName());
row1.add(s1.getNumber());
row1.add(s1.getAbsentTimes());
Vector<Object> row2 = new Vector<Object>();
row2.add(s2.getName());
row2.add(s2.getNumber());
row2.add(s2.getAbsentTimes());
Vector<Vector<Object>> studentData = new Vector<Vector<Object>>();
Vector<String> columnNames = new Vector<String>();
studentData.add(row1);
studentData.add(row2);
columnNames.add("姓名");
columnNames.add("编号");
columnNames.add("缺考次数");
JTable table = new JTable(studentData, columnNames);
JFrame f = new JFrame();
JScrollPane scrollPane = new JScrollPane(table);
f.getContentPane().add(scrollPane, BorderLayout.CENTER);
f.setVisible(true);
f.setSize(500, 500);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
热心网友 时间:2023-10-26 12:35
Vector<Object> rows, columns;
JTable tabledisplay = null;
。。。
tabledisplay = new JTable (rows, columns);
tabModel = new DefaultTableModel ();
rows = new Vector<Object> ();
columns = new Vector<Object> ();
tabModel.setDataVector (rows, columns);
。。。
columns.addElement ("。。");
columns.addElement ("...");
...
Vector<Object> r = new Vector<Object> ();
r.addElement (j++);
...
rows.addElement (r);
..
tabledisplay.addNotify ();
热心网友 时间:2023-10-26 12:35
Vector<Object> rows, columns;
JTable tabledisplay = null;
。。。
tabledisplay = new JTable (rows, columns);
tabModel = new DefaultTableModel ();
rows = new Vector<Object> ();
columns = new Vector<Object> ();
tabModel.setDataVector (rows, columns);
。。。
columns.addElement ("。。");
columns.addElement ("...");
...
Vector<Object> r = new Vector<Object> ();
r.addElement (j++);
...
rows.addElement (r);
..
tabledisplay.addNotify ();