我想在窗户关闭时停止声音,如何在处置时添加动作列表?
public Tetris(boolean sound) {
statusbarLabel = new JLabel(" 0");
add(statusbarLabel, BorderLayout.SOUTH);
Board board = new Board(this);
if(sound){
Sound.gameSound.play();
}
add(board);
board.start();
setSize(200, 400);
setTitle("Tetris");
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setLocationRelativeTo(null);
this.setVisible(true);
}