📄 soundeffects.java
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -