我已經提交的JButton有兩個的ActionListeners如何在內存中設置ActionListeners?
Category cat = new Category();
//this is launched second
submit.addActionListener(new ConfirmListener(new CategoryService(), cat));
//this is launched first. Set values
submit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String title = field.getText();
cat.setTitle(title);
}
});
難道他們把堆棧和他們彈出他們推出?第二個偵聽器設置對象的值,第一個偵聽器使用該對象。