关于 Java/Eclipse/Windowbuilder 未获取值的奇怪错误?
Odd, odd error regarding Java / Eclipse / Windowbuilder not getting values?
我有一个非常奇怪的问题.. "getValueAt" 方法 return 值与频率一不同 - 它 return 为空。我不明白为什么把table当作一个方法在里面。有人知道为什么吗?
JButton btnAdd = new JButton("Add ");
btnAdd.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
lblWeSuggestThe.setText(woooord);;
id.add(table_1.getValueAt(0,0)+"");
forename.add(table_1.getValueAt(0,1)+"");
surname.add(table_1.getValueAt(0,2)+"");
address.add(table_1.getValueAt(0,3)+"");
frequency.add(table_1.getValueAt(0,4)+"");
JLabel lblWeSuggestThe = new JLabel("We suggest the use of ID " + (id.size() + 1) + ".");
try {
FileWriter fw = new FileWriter ("southbank.csv", true);
fw.write("\n" + table_1.getValueAt(0,0) + "," +table_1.getValueAt(0,1) + "," +table_1.getValueAt(0,2) + "," +table_1.getValueAt(0,3) + "," +table_1.getValueAt(0,4) +"");
fw.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
*
对于那些将来遇到此问题的人,您必须在输入最终值后按回车键,或者单击与您输入的数据不同的列,因为数据不会被设置。
例如,在输入第五个也是最后一个条目后单击第四个条目。
我有一个非常奇怪的问题.. "getValueAt" 方法 return 值与频率一不同 - 它 return 为空。我不明白为什么把table当作一个方法在里面。有人知道为什么吗?
JButton btnAdd = new JButton("Add ");
btnAdd.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
lblWeSuggestThe.setText(woooord);;
id.add(table_1.getValueAt(0,0)+"");
forename.add(table_1.getValueAt(0,1)+"");
surname.add(table_1.getValueAt(0,2)+"");
address.add(table_1.getValueAt(0,3)+"");
frequency.add(table_1.getValueAt(0,4)+"");
JLabel lblWeSuggestThe = new JLabel("We suggest the use of ID " + (id.size() + 1) + ".");
try {
FileWriter fw = new FileWriter ("southbank.csv", true);
fw.write("\n" + table_1.getValueAt(0,0) + "," +table_1.getValueAt(0,1) + "," +table_1.getValueAt(0,2) + "," +table_1.getValueAt(0,3) + "," +table_1.getValueAt(0,4) +"");
fw.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
*
对于那些将来遇到此问题的人,您必须在输入最终值后按回车键,或者单击与您输入的数据不同的列,因为数据不会被设置。
例如,在输入第五个也是最后一个条目后单击第四个条目。