如何将Vector的内容放入JTable??
public class TestTable extends JPanel {
XYLayout xYLayout1 = new XYLayout();
JScrollPane jScrollPane1 = new JScrollPane();
TableModel model = new DefaultTableModel(5,5);
JTable jTable1 = new JTable(model);
Vector v = new Vector();
public TestTable() {
try {
jbInit();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
void jbInit() throws Exception {
xYLayout1.setWidth(680);
xYLayout1.setHeight(440);
this.setBackground(UIManager.getColor("InternalFrame.activeTitleGradient"));
this.setLayout(xYLayout1);
jTable1.setToolTipText("");
jTable1.setColumnSelectionAllowed(false);
this.add(jScrollPane1, new XYConstraints(0, 0, 680, 440));
jScrollPane1.getViewport().add(jTable1, null);
v.addElement("ss");
v.addElement("aa");
v.addElement("dd");
}
public static void main(String[] args) {
JFrame test = new JFrame();
TestTable test1 = new TestTable();
test.getContentPane().add(test1,BorderLayout.CENTER);
test.pack();
test.setSize(500,500);
test.setVisible(true);
}
}