【发布时间】:2018-12-11 12:37:46
【问题描述】:
我有一个static List<List<String>> tableValues;,我想在触发按钮“进入”后写入 JTable 我的列表已填满,因为我是 GUI 编程的新手,我不知道如何在事件发生后创建和填充表被触发,JTable 值动态变化。
btnEnter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String date = textField_3.getText();
//JTable table = new JTable();
//JScrollPane tableContainer = new JScrollPane(table);
try {
tableValues = Inserts.search(date,3); //table is filled
for(List<String> value : tableValues) {
System.out.println(value);
}
//table.setVisible(true);
//panel_7.add(tableContainer, BorderLayout.CENTER); --> I want to add the table to a Panel
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
【问题讨论】:
标签: java user-interface jframe jtable actionlistener