soundeffects.java

来自「用java模拟的电梯程序,可以选择有几层楼,一共有几个人在哪几层等电梯,可以不断」· Java 代码 · 共 34 行

JAVA
34
字号
// SoundEffects.java// Returns AudioClip objectspackage com.Anance.elevator.view;// Java core packagesimport 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 + -
显示快捷键?