📜  在 JTable java 中添加数据或添加行 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:04.029000             🧑  作者: Mango

代码示例1
private void jButton1ActionPerformed(java.awt.event.ActionEvent) {
    String data1 = something1.getSomething();
    String data2 = something2.getSomething();
    String data3 = something3.getSomething();
    String data4 = something4.getSomething();

    Object[] row = { data1, data2, data3, data4 };

    DefaultTableModel model = (DefaultTableModel) jTable1.getModel();

    model.addRow(row);

    // clear the entries.
}