soundeffects.java
来自「JAVA 多线程不可多得的好例子」· Java 代码 · 共 37 行
JAVA
37 行
// SoundEffects.java
// Returns AudioClip objects
package com.deitel.jhtp5.elevator.view;
// Java core packages
import java.applet.*;
public class SoundEffects {
// location of sound files
private String prefix = "";
public SoundEffects() {}
// get AudioClip associated with soundFile
public AudioClip getAudioClip( String soundFile )
{
try {
return Applet.newAudioClip( getClass().getResource(
prefix + soundFile ) );
}
// return null if soundFile does not exist
catch ( NullPointerException nullPointerException ) {
return null;
}
}
// set prefix for location of soundFile
public void setPathPrefix( String string )
{
prefix = string;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?