Java Code Examples for java.applet.Applet#newAudioClip()
The following examples show how to use
java.applet.Applet#newAudioClip() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Map.java From javagame with MIT License | 7 votes |
public Map(String filename) { sprites = new LinkedList(); coinSound = Applet.newAudioClip(getClass().getResource("se/coin03.wav")); // �}�b�v�����[�h���� load(filename); width = TILE_SIZE * col; height = TILE_SIZE * row; // �C���[�W�����[�h���� loadImage(); }
Example 2
Source File: BartThemeDialog.java From BART with MIT License | 6 votes |
public static Dialog getFunDialog() { FileObject img = FileUtil.getConfigFile("BartGIfImage/BartSaturdayNightFever.gif"); FileObject audio = FileUtil.getConfigFile("BartAudio/STheme.wav"); final AudioClip clip = Applet.newAudioClip(audio.toURL()); Icon icon = new ImageIcon(img.toURL()); JLabel label = new JLabel(icon); final Dialog dialog = new BartThemeDialog(WindowManager.getDefault().getMainWindow(), label); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if(e.getClickCount() == 1) { clip.stop(); dialog.dispose(); } } }); clip.loop(); return dialog; }
Example 3
Source File: SoundManager.java From Spark with Apache License 2.0 | 6 votes |
/** * Plays a sound file. * * @param soundFile the File object representing the wav file. */ public void playClip(final File soundFile) { final Runnable playThread = () -> { try { final URL url = soundFile.toURI().toURL(); AudioClip ac = fileMap.get(url); if (ac == null) { ac = Applet.newAudioClip(url); fileMap.put(url, ac); } ac.play(); } catch (MalformedURLException e) { Log.error(e); } }; TaskEngine.getInstance().submit(playThread); }
Example 4
Source File: FileUtil.java From JAVA-MVC-Swing-Monopoly with Apache License 2.0 | 5 votes |
public static AudioClip getAudio(String path) { URL url = getURL("audio", path); if(url == null) { return null; } return Applet.newAudioClip(url); }
Example 5
Source File: AlertManager.java From Spark with Apache License 2.0 | 5 votes |
private AudioClip getAlertClip(String alertResourceName, boolean create) { AudioClip clip = (AudioClip) alertClips.get(alertResourceName); if (clip == null && create) { clip = Applet.newAudioClip(PhoneRes.getURL(alertResourceName)); if (clip != null) { alertClips.put(alertResourceName, clip); } } return clip; }
Example 6
Source File: Wizard.java From javagame with MIT License | 5 votes |
public Wizard(MainPanel panel) { this.panel = panel; // �C���[�W�����[�h try { wizardImg = ImageIO.read(getClass().getResource("wizard.gif")); } catch (IOException e) { e.printStackTrace(); } // �T�E���h�����[�h spellClip = Applet.newAudioClip(getClass().getResource("spell.wav")); }
Example 7
Source File: MainPanel.java From javagame with MIT License | 5 votes |
public MainPanel() { setPreferredSize(new Dimension(WIDTH, HEIGHT)); addMouseListener(this); // �T�E���h�����[�h thunderSound = Applet.newAudioClip(getClass().getResource("don09_a.wav")); // �Q�[�����[�v�J�n gameLoop = new Thread(this); gameLoop.start(); }
Example 8
Source File: SoundManager.java From Spark with Apache License 2.0 | 5 votes |
/** * Creates an AudioClip from a URL. * * @param clipOfURL the url of the AudioClip to play. We only support .wav files at the moment. * @return the AudioFile found. If no audio file was found,returns null. */ private AudioClip loadClipForURL(String clipOfURL) { final URL url = SoundsRes.getURL(clipOfURL); AudioClip clip = null; try { clip = Applet.newAudioClip(url); } catch (Exception e) { Log.error("Unable to load sound url: " + url + "\n\t: " + e); } return clip; }
Example 9
Source File: Coin.java From javagame with MIT License | 4 votes |
public Coin(double x, double y, String fileName, Map map) { super(x, y, fileName, map); // �T�E���h�����[�h sound = Applet.newAudioClip(getClass().getResource("se/coin03.wav")); }
Example 10
Source File: JumperTwo.java From javagame with MIT License | 4 votes |
public JumperTwo(double x, double y, String fileName, Map map) { super(x, y, fileName, map); // �T�E���h�����[�h sound = Applet.newAudioClip(getClass().getResource("se/pyoro57_b.wav")); }
Example 11
Source File: Coin.java From javagame with MIT License | 4 votes |
public Coin(double x, double y, String fileName, Map map) { super(x, y, fileName, map); // �T�E���h�����[�h sound = Applet.newAudioClip(getClass().getResource("se/coin03.wav")); }
Example 12
Source File: JumperTwo.java From javagame with MIT License | 4 votes |
public JumperTwo(double x, double y, String fileName, Map map) { super(x, y, fileName, map); // �T�E���h�����[�h sound = Applet.newAudioClip(getClass().getResource("se/pyoro57_b.wav")); }
Example 13
Source File: Accelerator.java From javagame with MIT License | 4 votes |
public Accelerator(double x, double y, String fileName, Map map) { super(x, y, fileName, map); // �T�E���h�����[�h sound = Applet.newAudioClip(getClass().getResource("se/chari13_c.wav")); }
Example 14
Source File: Coin.java From javagame with MIT License | 4 votes |
public Coin(double x, double y, String fileName, Map map) { super(x, y, fileName, map); // �T�E���h�����[�h sound = Applet.newAudioClip(getClass().getResource("se/coin03.wav")); }
Example 15
Source File: JumperTwo.java From javagame with MIT License | 4 votes |
public JumperTwo(double x, double y, String fileName, Map map) { super(x, y, fileName, map); // �T�E���h�����[�h sound = Applet.newAudioClip(getClass().getResource("se/pyoro57_b.wav")); }
Example 16
Source File: FakeAppletContext.java From 07kit with GNU General Public License v3.0 | 4 votes |
@Override public AudioClip getAudioClip(URL url) { return Applet.newAudioClip(url); }
Example 17
Source File: Accelerator.java From javagame with MIT License | 4 votes |
public Accelerator(double x, double y, String fileName, Map map) { super(x, y, fileName, map); // �T�E���h�����[�h sound = Applet.newAudioClip(getClass().getResource("se/chari13_c.wav")); }
Example 18
Source File: Accelerator.java From javagame with MIT License | 4 votes |
public Accelerator(double x, double y, String fileName, Map map) { super(x, y, fileName, map); // �T�E���h�����[�h sound = Applet.newAudioClip(getClass().getResource("se/chari13_c.wav")); }
Example 19
Source File: AudioClipApp.java From javagame with MIT License | 4 votes |
public AudioClipApp(String filename) { setTitle("AudioClip�̍Đ�"); AudioClip clip = Applet.newAudioClip(getClass().getResource(filename)); clip.play(); }
Example 20
Source File: Coin.java From javagame with MIT License | 4 votes |
public Coin(double x, double y, String fileName, Map map) { super(x, y, fileName, map); // �T�E���h�����[�h sound = Applet.newAudioClip(getClass().getResource("se/coin03.wav")); }