All pastes #2057202 Raw Edit

Miscellany

public text v1 · immutable
#2057202 ·published 2011-05-12 05:47 UTC
rendered paste body
import java.awt.event.MouseEvent;

import java.util.ArrayList;

import javax.swing.JFrame;
import javax.swing.JButton;

import java.applet.*;

public class Tester
{
    static ArrayList<Thing> list;

    public class Sound // Holds one audio file
    {
        private AudioClip song; // Sound player
        private URL songPath; // Sound path
        Sound(String filename)
    {
    try
    {
        songPath = new URL(getCodeBase(),filename); // Get the Sound URL
        song = Applet.newAudioClip(songPath); // Load the Sound
    }
    catch(Exception e){} // Satisfy the catch
 }
 public void playSound()
 {
 song.loop(); // Play 
 }
 public void stopSound()
 {
 song.stop(); // Stop
 }
 public void playSoundOnce()
 {
 song.play(); // Play only once
 }
    public static void main(String[] args) throws java.net.MalformedURLException
    {
        frame = new JFrame();
        frame.setSize(600, 600);
        frame.setTitle("Main Menu");
        frame.getContentPane().setLayout(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       
        startMenu menu = new startMenu();
        //This line of code below cannot be found
        Sound sounds = new Sound("");
       
        menu.pickHumans();
        menu.pickRobots();
        menu.pickAliens();
       
        frame.remove(menu);
       
        frame.setVisible(true);
       
        sounds.playSound();
       

    }
   
   
    static JFrame frame;
}