Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要帮助,我是 Java 新手。我有一张桌子,有 3 列 ID、姓名、年龄。在 jTextfield 输入的每个数据都会显示到表格中。表格中的数据显示也将显示在文本文件中。
如果要填充表格,您可能需要使用 DefaultTableModel。创建一个输入数组并简单地添加到您的表中。
DefaultTableModel dtm = (DefaultTableModel) jTable1.getModel(); String a[] ={jTextField1.getText(),jTextField2.getText(),jTextField3.getText()}; dtm.addRow(a);