1
我可以匿名事件處理方法行事條件像有條件的事件處理程序
JButton activeDataBtn = new JButton("Active");
activeDataBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
if (activeDataPanel.setVisible(false)) { //Erroneous code
readDataFromFile(); //a method reads data from .csv
//file and shows it on activeDataPanel
activeDataPanel.setVisible(true);
}
else
activeDataPanel.setVisible(false);
}
}
});
我怎麼能做出這樣的條件?
任何建議appriciated –