I need to know if a specific action event has been performed because in the if statement I will have another action be performed, but it depends on which action event(s) have already been performed.
xButton9.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent x9) {
xButton9.setVisible(false);
oButton9.setVisible(false);
nine.repaint();
nine.add(xlabel);
}
} );
oButton9.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent o9) {
xButton9.setVisible(false);
oButton9.setVisible(false);
nine.repaint();
nine.add(olabel);
}
} );
if (ActionEvent 09 has been performed) {
do this stuff
}
You need to handle that inside of your actionPerformed()
method, while you still have a reference to o9
.
oButton9.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent o9) {
xButton9.setVisible(false);
oButton9.setVisible(false);
nine.repaint();
nine.add(olabel);
// whatever else happens when oButton9 is clicked
}
} );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.