bombersndeffect.java
来自「这是个双人对战的乒乓球游戏」· Java 代码 · 共 36 行
JAVA
36 行
import java.io.*;
/**
* File: BomberBGM
* Copyright: Copyright (c) 2001
* @author Fu Bin MSN:yonghe169@163.com
* @version 1.0
*/
/**
* This class plays the background music.
*/
public class BomberSndEffect extends Thread {
public BomberSndEffect() {
start();
}
public void playSound(String str) {
/** if Java 2 is available */
if (Main.J2) {
SoundPlayer sound = null;
try {
/** create sound player */
sound = new SoundPlayer(
new File(BomberMain.RP +
"Sounds/BomberSndEffects/" + str + ".mid").
getCanonicalPath());
}
catch (Exception e) { }
/** open file */
((SoundPlayer)sound).open();
/** then play sound */
sound.change(0, false);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?