Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ma classe Sound.java:
- import java.applet.*;
- public class Sound {
- public static final Sound sound1 = new Sound("https://dl-web.dropbox.com/get/Halocube/Heart%20of%20Courage.wav?w=AAC9hdZykOMXLdPphitnFjVuKRj7ue6azrIY0ut-yTn1jw");
- private AudioClip ac;
- public Sound(String file){
- try{
- ac = Applet.newAudioClip(Sound.class.getResource(file));
- }catch(Exception e){e.printStackTrace();}
- }
- public void play(){
- try{
- new Thread(){
- public void run(){
- ac.play();
- }
- }.start();
- }catch(Exception e){e.printStackTrace();}
- }
- }
- Ma classe GuiMainMenu.java:
- public class Main{
- public Main(){
- Sound.sound1.play();
- }
- public void main(String[] args) {
- Main main = new Main();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment