?? menulistener.java
字號:
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class MenuListener implements ActionListener
{
private Box box;
private Game game;
public MenuListener(Box box,Game game)
{
this.box=box;
this.game=game;
}
@Override
public void actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
if(e.getActionCommand().equals("開始/暫停"))
{
if(box.cmd==1)box.cmd=0;
else box.cmd=1;
}
if(e.getActionCommand().equals("退出游戲"))
{
System.exit(0);
}
if(e.getActionCommand().equals("重新開始"))
{
game.restart();
}
if(e.getActionCommand().equals("關于游戲"))
{
game.about();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -