Need help playing multiple songs in an applet

Hello,
I have been working on this problem for about a week now and am losing my mind. I have a Applet that plays 5 somgs and displays 5 images, but only 2 songs are playing. Here is were the problem is;
SongPlaying = Song.getSelectedIndex()== 5 ?
Song1 : Song2;I know i am only specifying Song1 and Song2, but I dont know how to change this with out dramatically altering my code(atleast that is what I have been trying).
Any help would be greatly appriciated, I am very new to JAVA

OK, I cant find the problem here is my code, any ideas would be a great help. It just does not seam to recognize the correct ComboBox selection and the Stop button does not always work
import java.applet.Applet;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.URL;
import java.io.*;
public class TeamProject extends JApplet implements ActionListener 
private AudioClip SongPlaying, Song0, Song1, Song2, Song3, Song4, Song5;
private JButton playSong, loopSong, stopSong;
JComboBox Song;
JLabel picture;
public void init()
resize(650, 500);
Container container = getContentPane();
container.setLayout( new FlowLayout());
String Songs[] = { "Please Select Song", "MatchBox 20-Unwell", "Maroon 5-Harder to Breathe",
"3 Doors Down-Duck & Run", "U2-Vertigo", "Goo Goo Dolls-Slide"};
playSong = new JButton("Play");
playSong.addActionListener(this);
container.add(playSong);
loopSong = new JButton("Loop");
loopSong.addActionListener(this);
container.add(loopSong);
stopSong = new JButton("Stop");
stopSong.addActionListener(this);
container.add(stopSong);
Song = new JComboBox(Songs);
Song.addItemListener (new ItemListener ()
public void itemStateChanged(ItemEvent e)
String strTemp = Song.getSelectedItem().toString();
System.out.println(strTemp);
showStatus("Playing sound " + strTemp );
      if (Song == null)
      showStatus("Sound " + strTemp + " not loaded yet.");
      return;
picture = new JLabel();
container.add(Song);
container.add(picture);
Song0 = getAudioClip(getDocumentBase(), "Please Select Song.wav");
Song1 = getAudioClip(getDocumentBase(), "MatchBox 20-Unwell.wav");
Song2 = getAudioClip(getDocumentBase(), "Maroon 5-Harder to Breathe.wav");
Song3 = getAudioClip(getDocumentBase(), "3 Doors Down-Duck & Run.wav");
Song4 = getAudioClip(getDocumentBase(), "U2-Vertigo.wav");
Song5 = getAudioClip(getDocumentBase(), "Goo Goo Dolls-Slide.wav");
SongPlaying = a;
public void stop()
SongPlaying.stop();
public void actionPerformed(ActionEvent e)
if (e.getSource() == loopSong)
SongPlaying.loop();
String image = (String)Song.getSelectedItem();
image(image);
if (e.getSource() == stopSong)
SongPlaying.stop();
if (e.getSource() == playSong)
image = (String)Song.getSelectedItem();
image(image);
SongPlaying.play();
int indx = Song.getSelectedIndex();
if (indx == 0)
SongPlaying = Song0;
else
if (indx == 1)
SongPlaying = Song1;
else
if (indx == 2)
SongPlaying = Song2;
else
if (indx == 3)
SongPlaying = Song3;
else
if (indx == 4) 
SongPlaying = Song4;
else
if (indx == 5) 
SongPlaying = Song5;
public void image (String name)
ImageIcon icon = createImageIcon("images/" + name + ".jpg");
picture.setIcon(icon);
if (icon != null)
picture.setText(null);
else
picture.setText("Image not found");
public static ImageIcon createImageIcon(String path)
java.net.URL imgURL = TeamProject.class.getResource(path);
if (imgURL != null)
return new ImageIcon(imgURL);
else
System.err.println("Couldn't find file: " + path);
return null;
}

Similar Messages

  • Need help playing a song previously purchased in 2006

    I cannot play a song that I purchased in 2006. On a new computer, it doesn't even show up inthe purchased option. Anyone know how to fix this? Thanks!

    Hey KAZ410,
    Let's check to see what account purchased this song:
    Recovering a forgotten iTunes Store account name
    http://support.apple.com/kb/HT1920
    1. Open iTunes
    2. Highlight one of the items you have purchased (You can find your purchases in your Purchases playlist).
    3. Choose File > Get Info.
    4. Click the Summary tab.
    The Account Name area will list the account used to purchase the item. Unless you have changed accounts, this is your iTunes Store account name.
    Now that we know what account purchased this item, try logging into the iTunes Store with that account. If successful, proceed to your purchased page to download the song again (you'll have to delete the original before downloading again, but make sure it is in the purchase history first).
    Thanks,
    Matt M.

  • I need to play a song on a Keynote presentation, how do I do this ? I use to drag and drop the mp3 in Keynote but it stops playing when the slide move to the other one... how can I make the song keep playing through the whole presentation ? Thanks.

    I need to play a song in a row in a Keynote presentation, how do I do this ? I use to drag and drop the mp3 in Keynote but it stops playing when the slide move to the other one... how can I make the song keep playing through out the presentation ?
    Thanks.

    Drag the file into the audio window in the Document inspector...

  • Why does my music player on my iPhone 4 always revert back to the same song when in shuffle mode even tho I have played multiple songs since that first song was played.very frustrated

    Why does my music player on my iPhone 4 always revert back to the same song when in shuffle mode even tho I have played multiple songs since that first song was played.very frustrated

    SHuffle does not play songs in a truly random fashion.  Like all computer related random generators the sequence is pseudo-random

  • Need help with multiple accounts

    I forgot my original password for my itunes account.  Stupidly, i set up another one.  Now I can't play my songs from my original account because I hace to put in that password.  Tried reseting the password, but the email address from that account has been deactivated, so when it says" will sennd to email address on file, I can't retrive the email to rest the password.  Is there a way to merge both accounts?

    No.  You cannot merge the accounts.  Sorry.
    You can try contacting itunes support for help with your password.

  • Wrt54g i need help playing c&c online it keeps losing connection

    i need help bad with getting command and conquer generals to play online because i never had a problem before with connection prior to getting the router but now i can't stay on for more then 30 seconds and i am really frustrated, can u please help me?

    Hi…Every game works on different TCP or UDP ports.  You need to forward these ports on your router and reduce the MTU to 1365. So get the port no required by your game, forward the port for the IP address of your PC.

  • I need help importing my songs from CDs

    i've imported my cd's to my itunes and it shows up in my library on my laptop , but it doesnt show up on my ipod.

    Is its memory full? You may need to delete some songs.
    Try changing the iPod's options to just sync music that you checked:

  • I need help! My songs sound weird.

    I don't know why but when i play my songs on my itouch, the songs seem to be playing at a faster speed and of higher pitch. Why does this happens and what can i do to correct this problem? It's okay when i played it on itunes.

    Are these songs that you have downloaded as Podcasts? Or, have you changed the *Media Kind* so that they are now Podcasts?
    If so, perhaps the Touch is set to play at x2 speed, which is an option for Podcasts. Look at you *Now Playing* screen. If you cannot see the progress bar at the top, tap the screen briefly to display it. Look on the right, there is a box that should say 1x. If it's blue and says 2x, then the iPod is playing fast. Tap the box twice, it will change the speed to half speed, then normal.
    Phil
    By the way, since Singapore is eight hours ahead of the UK and I assume it was 15.58 +your time+ when you posted, that made it midnight +my time+ - I was on a night out. Others here in the UK may have been asleep. Don't forget that this is a worldwide forum and answers may come from any part of it.
    Message was edited by: the fiend

  • Need help: playing songs in order, strangewindow message, upgrading I-Tunes

    I have 2 situations I hope someone can help me with:
    1: PLAYING SONGS IN ORDER; WINDOW MESSAGE
    I have CDs of music that when I load them onto my pc laptop the song names don’t come up—each song lists as “track 01” “track 02” etc.
    When I try to play the album thru I-Tunes on my laptop, the songs won’t play in order. i.e. ALL the “track 02”s will play before going to “track 03,” then ALL the “track 03”s will play, etc. So I made a playlist of each CD.
    Now when I try to play the Playlist, I get a window message that says, “The song “Track 01” could not be used because the original file could not be found. Would you like to locate it?” I can choose ‘yes’ or ‘cancel.’ YES takes me to folder selections. I find the song and click on it and then it plays.
    There must be an easier way. I don’t want to search for each song one at a time in order to play an entire CD in order.
    2: UPGRADE
    I need to upgrade. I have I-TUNES 7.0.2. I went online to apple.com and couldn’t find any upgrade option, so I clicked on “download I-tunes”. I got a window that says “download complete.” But how do I tell if it’s really installed? Where do I go on my computer to see what version number it shows?
    Any help is appreciated,
    Carolyn in Las Vegas

    2. Help->About iTunes
    1. You have done something that has confused iTunes about the location of the files in its library. Without knowing what happened, it's hard to make a specific recommendation, but if you moved your files around manually, move them back, and then, if you want to change the location, do it only by setting it in iTunes preferences and then using Consolidate Library.

  • Need Help Playing iPod on multiple computers

    My iTunes library resides on my desktop computer at home. I also have iTunes loaded on my work computer (a laptop) so I can play music from my iPod through my work computer. I have set my work computer iTunes to manually manage music and video but I do not get a play list available for me to choose music to play from the iPod. This functionality was fine using the older versions of iTunes and iPod software. I lost functionality when I upgraded my software.
    How can you access your iPod library when you are using iTunes (with no songs in its library) just to play music through a second computer?
    Dell 8100   Windows XP Pro  

    That was exactly it! It works like a charm! Thank you so much for your help

  • Need help playing library from multiple machines...

    My main computer (desktop) @ my house 'houses' my mp3 collection. I have networked laptops in my garage and just added another laptop to my tv room to play music from.
    The problem I run into is having the laptop rescan the desktops library over and over and over again.
    Is there a way to 'sync' the xml library file the desktop is using to the laptops? I constantly add files to 'the library' and am increasingly agitated every time I use one of the laptops and my 'new' music is not there.

    Did you try sharing your Music from within iTunes? On your Desktop computer, in Preferences, Sharing tab, check "Share my library...".
    On the other computers, make sure "Look for shared libraries" is checked. As long as iTunes is open on the "main" computer, all the other ones should be able to listen to music from the main computer by selecting it from the "Shared" section in the sources list.

  • Need help with multiple iTunes files

    i had iTunes songs/files on an old pc for years, backed up on an external hard drive.  i then backed up that external drive with another newer external drive and hooked that newer drive to the mac.  i then imported all songs onto the mac iTunes library.
    now when i look at the song list in iTunes on the mac, there are three versions of every song - the first one will play but the next two versions give me the explanation point next to them and say they can't be found.  HOW DO I ELIMINATE THE SECOND AND THIRD COPIES OF EACH SONG THAT CANNOT BE FOUND - TRYING TO CLEAN THINGS UP.
    thanks

    This technique should help you identify which entries need to be removed.
    Lost & Found Playlists
    Create a playlist called Found, select everything in Music and drag it into the Found playlist (it may take some time to count the tracks that are to be dropped). Create a smart playlist called Lost matching All the rules Playlist is Music and Playlist is not Found. Your lost tracks will be in this playlist. Cmd+A should select all and Option-Delete should delete them.
    Or try Super Remove Dead Tracks.
    tt2

  • NEED HELP PUTTING MULTIPLE PAGES TOGETHER IN 1 PDF

    HOW DO I PUT 10 PAGES TOGETHER TO OPEN IN 1 PDF?

    Thanks Janelle - I do not have that ability with the Epson RX580. Epson just answered my tech support question with this answer:
    I am sorry you are experiencing difficulties with your EPSON Stylus Photo RX580. Unfortunately this feature is not available with Mac OS X. You will need a third-party software that will help you with this, such as Poster Print for Mac or Tiler. Please note though that Epson does not support these applications.
    So I guess my question becomes what software can I use to print my images on multiple pages. As I do large photo transfers I need to be able to do this with my mac in an efficient way and not try to cut portions of image into seperate print jobs that would be too time consuming. HAve you had any experience with other software. If not I guess the next question  what printer would you recommend that would do this with my MAC. I have included a pic of one of my larger transfers on a cupboard. To do this I needed the image to be tiled on 8 different sheet of 8.5x11 so this is a feature I need through either software or a printer that is easy to use and easily accessible. Thanks Krista
    I am inl

  • Syncing bought songs problem from computer to ipod suffle 6th gen. Despartely need help., Syncing bought songs problem from computer to ipod suffle 6th gen.

    Okay I have upload songs from my CD's as well. That along with bought idem's are not syncing with my iPod. I can deal without my songs from my CD's, but the some song I bought from the iTunes store seems really unreasonable. I would appreciate some help with this please.

    Try playing the TV Show straight from your iTunes library. It will probably ask you for your iTMS login information. Punch it in, and everything should work fine.

  • Need help importing iTunes songs!

    When I try to import from iTunes, Garage band says: 'Open iTunes to populate this list', or 'Loading iTunes music' but it never loads tracks. Ive uninstalled GarageBand already, didnt fix the problem (I also have the updated version of both apps). This feature used to work but it doesn't any more. Any help on how to solve this issue would be greatly appreciated!

    It looks like the Media Browser can't find the iTunes Library, and that it is probably a problem with iTunes and not with Garageband.
    Do you have the latest Version 10.4.1 of iTunes installed? If not, I would recommend to update to the newest iTunes Version.
    And check, if other Applications (like iMovie, iDVD, iPhoto, iWorks) can see iTunes in the Media Browser.
    If not, then make sure that the settings in the iTunes Preferences -> Advanced are pointing to the correct location of your Library.
    By default the Library should be located in your Music Folder
        /Users/your user name/Music/iTunes/iTunes Music
    If the Library location settings should be wrong, then correct the settings, and restart both iTunes and Garageband.
    If your iTunes  Library is on an external disk, the media Browser mignt not find it.Then just - in iTunes - reveal the song in the Finder, by ctrl-clicking it, and drag it from the Finder into your Garageband window.
    If your iTunes Library is on an internal disk and still the Media Browser can't see it, then check the permissions of the Library and run a disk check with disk utility and repair the disk, if need be.

Maybe you are looking for

  • Round badi does not work in default formulas triggered when sending a value

    I have implemented the round BADI from sdn (how to). Problem is that it works perfect when : -  I execute it in UKT - I run it as a data manager package - I put it in default formulas and run the default formulas as a packe It however doesn't work wh

  • Service PR Creation

    Hi,      I am working on Service Purhase Requistion creation.For this i am using BAPI_REQUISTION_CREATE.If i am giving incorrect input values system immedatily showing the error.whenver i am giving correct input values.system at status bar its displa

  • How can I put the Rollover Image code in a separate file?

    Hey folks, I'm in the process of building a new site and have used DW's Image Rollovers for the navigation. Of course the downside is the amount of JavaScript and the like DW inserts in to the code. I was wondering if this code could be inserted in t

  • Error while importing s/w component verion in Integration Builder

    Hi There, I am getting below error while importing software components in System Landscape directory. "Unable to read software component verion from System landscape directory "SAPXI:50000" Path In Integration Builder> Tools>Transfer from System Land

  • I can't publish to anything, have update to CP 7

    I can't publish to anything, have update to CP 7. Have try to just SWF, and HTML5 and both. No vide just audio, image and text.