Java基于swing实现的弹球游戏代码(2)
public void actionPerformed(ActionEvent e) {
String com = e.getActionCommand();
if (com.equals("暂停")) {
button.setMargin(new Insets(0, 0, 0, 0));
button.setIcon(new javax.swing.ImageIcon("images/start.gif"));
button.setActionCommand("继续");
for (int i = 0; i < list.size(); i++) {
list.get(i).PauseThread();
}
}
if (com.equals("继续")) {
button.setMargin(new Insets(0, 0, 0, 0));
button.setIcon(new javax.swing.ImageIcon("images/Pause.gif"));
button.setActionCommand("暂停");
for (int i = 0; i < list.size(); i++) {
list.get(i).ContinueThread();
}
}
}