a:Textfield中添加数据并且向JTable中导入数据
b:数据并且通过IO流导入到文本文档中去
直接用swing控件拖啊,加事件就行。
希望对你有帮助
//参考:
//假设是按钮触发事假,大致代码
addButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Prodouct= 通过Textfield和其他空间得到的对象比如产品
productTable.addProduct(product);
}
}
});
productTable 对象封装 ,大致代码
public class ProductTable {
private JTable table;
public void addProduct(Product product){
tableModel.addRow(new Object[]{product.getId(),product.getName(),product.getBusinessType(),product.getGrade(),product.getDescrip()});
}
}