Button doesnt work

Hi
Below is the coding that i have created i am trying to make the button play a sound when it is pressed. It worked for one button but when i put the second button it doesnt work, any help will be greatly appreciated. Thanks
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.io.*;
import java.text.*;
import java.util.*;
import java.io.PrintStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.applet.AudioClip;
import java.net.URL;
public class Panel1 extends JPanel implements ActionListener
private JButton logout, open;
//AudioClip onceClip, loopClip;
//URL codeBase;
public Panel1()
//String [] fileTypes = {wavFile};
//public MalformedURLException();
//private URL("C:/JBuilder3/myprojects/untitled1/)
//throws MalformedURLException
logout = new JButton(" Logout ");
logout.addActionListener(this);
logout.setActionCommand("logout");
open = new JButton("Hello");
open.addActionListener(this);
open.setActionCommand("Hello");
JPanel controlPanel = new JPanel();
controlPanel.add(logout);
controlPanel.add(open);
add(controlPanel);
public void actionPerformed( ActionEvent evt )
// play a sound before loging out
try
if (logout == logout);
java.applet.AudioClip clip =
java.applet.Applet.newAudioClip(new java.net.URL("C:/JBuilder3/myprojects/untitled1/logout.wav"));
clip.play();
catch (MalformedURLException ex)
try
(open = open);
java.applet.AudioClip clip =
java.applet.Applet.newAudioClip(new java.net.URL("C:/JBuilder3/myprojects/untitled1/i.wav"));
clip.play();
catch (MalformedURLException pex)
public static void main(String s[]) {
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}
JFrame f = new JFrame("Panel");
f.addWindowListener(l);
f.getContentPane().add(new Panel1());
//f.setSize(new Dimension(400,100));
f.show();
}

Please use code tags, as described in formatting tips.
What does "does not work" mean? Throws an execption, nothing happens when you click the button, comple error?

Similar Messages

  • I have an old ipod touch and it keeps saying, ipod is disabled. I connected it to itunes and it said, sorry you need to put the passcode in, but it wont let me. And my power button doesnt work.

    I have an old ipod touch and it keeps saying, ipod is disabled. I connected it to itunes and it said, sorry you need to put the passcode in, but it wont let me. And my power button doesnt work.

    iOS: Unable to update or restore

  • I have an iphone 5 that i trade with a family member they have coverage on it. now the iphones sleep wake button doesnt work sometimes can apple replace my iphone even if i dont have the box or recipit to the product or can they just repair it?

    i have an iphone 5 that i traded with from a family member. its has coverage but now the sleep/wake button doesnt work sometimes. can apple replace my iphone and give me a new one or is it just something they can repair? i dont have the box or recipit to apple care or the iphone

    Apple can fix it without your receipt or box. They pull the serial number from the device and determine warranty status from that.  Hopefully ApplCare was registered to the product before you lost the receipt though.  If not, you can go back to the point of purchase and obtain your AppleCare receipt and Apple can help attach it to the iPhone.

  • I have an ipod either 1st or 2nd generation,very old but my problem is that i forgot the password and i need to reset it. The problem is i cant reset it because my sleep button doesnt work

    I need to reset my ipod but i cant do that because my sleep button doesnt work any more and plus i dont remember my password.HELP

    Place the iPod in recovery mode using one of these programs and then restore via iTunes:
    For PC
    RecBoot: Easy Way to Put iPhone into Recovery Mode
    If necessary:
    Download QTMLClient.dll & iTunesMobileDevice.dll for RecBoot
    and                                           
    RecBoot tip
    For MAC or PC       
    The Firmware Umbrella - TinyUmbrella

  • How do you get your ipod unfrozen if your lock button doesnt work?

    My lock button doesnt work anymore and my ipod's screen is frozen. How do i get it unfrozen without using the lock button?

    Try the instruction here the best you can. WHen it says place the iPod in recovery mode use this program.
    RecBoot: Easy Way to Put iPhone into Recovery Mode
    - iOS: Not responding or does not turn on
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • I forgot my ipod password and i didnt use it for along time so it wont even connect to itunes plus it fell in the toilet so my home button and volume button doesnt work what do i do?

    I forgot my ipod password and i didnt use it for along time so it wont even connect to itunes plus it fell in the toilet so my home button and volume button doesnt work what do i do?

    Place the iOS device in recovery mode using this program
    RecBoot: Easy Way to Put iPhone into Recovery Mode
    http://jaxov.com/2010/05/recboot-iphone-recovery-mode/and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                          
    If recovery mode does not work try DFU mode.                         
    Enter DFU mode without home button or Power Button | technoNix
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • Menu button doesnt work

    All of a sudden the menu button stopped working. It was fine one day then I put the ipod on charge, several days later when I tried to use it again the Menu button no longer works...
    Actually I just realized that the Play/Pause button doesnt work correctly either. When you push and hold it it does not turn the device off anymore although it would still pause/play the songs. The forward/reverse work ok.
    I tried resetting the Ipod using the updater and that didnt help. I also tried Menu + Select ... strangely enough it resets the device but after it resets the Menu key doesnt work.
    Has anyone experienced this problem?
    I submitted a service request. Is there any way of modifying the service request since I just realized that the play/pause button is screwed up also?
    Finally, when you turn the hold on/off is that supposed to turn the backlight on/off as well? I never paid attention to it but now when I turn hold on that also turns the backlight on...is that screwed up as well?

    I am having a similar problem with my mini - it turns on fine and will scroll through the menus, but will not respond by going back through the menus. Instead, it freezes on a screen and does not respond to anything except resetting it (menu & select button). Doesn't seem like the proper way to navigate through the screens and is completely frustrating. I was ready to cry yesterday at the gym because it wouldn't work and didn't know the reset "trick" until 3 hours later! I have also had many problems turning it off too. My brother who owns a regular iPod thinks I am crazy but at least I am seeing people out there with similar problems.
    On another note, I have to say I am completely disappointed with Apple. The company loves to portray this user-friendly persona, but in truth it is not that way at all. I received my mini in May and have just started to use it full force this month (October) ... now my 30-day phone support has expired and if I want "live" help I have to pay $50 for extended service. That's bull - I'd like some real answers but have been relegated to chat boards (no offense) and trying to troubleshoot the problem myself by finding close but not exact postings. It seems like such a deceptive bait & switch ploy by Apple. I am tempted to send my mini back for service but just read on the web site that I could be charged up to $100 for service. Again, sounds very sneaky so not sure if I should take the risk or live with a highly annoying product defect. Any suggestions?

  • I was in the middle of updating to 7.0.3 and Itunes stopped working. Now my phone is stuck in limbo (apple logo with status bar under) My power button doesnt work (of course) How do I get it back to normal?

    I was in the middle of updating to 7.0.3 and Itunes stopped working. Now my phone is stuck in limbo (apple logo with status bar under) My power button doesnt work (of course) How do I get it back to normal?

    I have same issue. I click on the home button and Wake/sleep at the same time for 30 seconds or more and then the phone entered in Recovery mode. It is erasing my content now and installing the update. Let´s see how this ends. I have iCloud, iTunes match, and backups from previos versions, hope I can restore all my content.
    Otherwise I´ll go to the Genius Bar to do a checkup.
    Good luck!
    It did not work the first time... The iPhone4 kept in limbo. Then I did disconnect as suggested above and tried again to enter in Recovery mode.  This second time it works. And after restoring the iPhone4 with 7.0.3, it asked me if I want to recover from backup. I did recover from my latest back up and now it is syncing the content.

  • My Sleep button doesnt work and my ipod its frozen in apple screne what can i do??!?!?!?!?!?!?

    My sleep button doesnt work so i tried to restore when i was restoring it was the apple with the loading circle it just stop and it dosent move from 1 day ago an i cant restore with sleep an home button cause it dont work!!!! When i connect it to itunes it dosent apper even if i press the home button.                        PLEASE HELP !!!!!!!!!!!!!!!!!!!!!!!!

    Try the following:
    - A reset. Nothing is lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset network settings: Settings>General>Reset>Reset Network Settings
    - Restore from backup
    - Restore to factory settings/new iPod.

  • My iphone 4s screen has just turned black but it is still vibrating. I was reading other messages similar and it says to resart phone but holding the home and lock button. However my lock button doesnt work what should i do?

    my iphone 4s screen has just turned black but it is still vibrating. I was reading other messages similar and it says to resart phone but holding the home and lock button. However my lock button doesnt work what should i do?

    Is it the Home button that doesn't work, or the Power (Sleep/Wake) button? If the Power button works, you can switch it off. Not sure how you have been able to do anything without the Home button working?
    Cheers,
    GB

  • My iphone 4s is frozen and my lock button doesnt work and i cant slide to power off the phone. HELP

    my iphone 4s is frozen on the lock screen. my lock button doesnt work and i cant slide to power off the phone. It has 100% battery and nothing happens when  i plug it into the computer.
    My phone screen also is in negative. It is like twitching and ive tried to invert the colors but thats not it. i cant see any apps, pictures , or anything in regular colors. PLEASE HELPPP!

    You can't.  You'll have to wait until the battery runs out and then recharge the phone.  It will restart.
    Sounds like now's a good time to get the phone fixed.

  • HT1212 i have a iphone 8g and the lock button doesnt work and i forgot my password and i was wondering if anybody can help me??

    i have a iphone 8g and the lock button doesnt work and i forgot my password and i was wondering if anybody can help me??

    You will need to restore your iPhone, take a look at this link, http://support.apple.com/kb/HT1212

  • HT1212 dont know my daughters ipod 4th generation passcode.  If her shut off button doesnt work, is there any way of reseting the device?

    Can anyone help me restore my daughter ipod 4th generation if the shut off button doesnt work?

    Place the iPod in recovery mode using one of these programs:
    For PC
    RecBoot: Easy Way to Put iPhone into Recovery Mode
    If necessary:
    Download QTMLClient.dll & iTunesMobileDevice.dll for RecBoot
    and                                           
    RecBoot tip
    For MAC or PC       
    The Firmware Umbrella - TinyUmbrella
    Then restore via iTunes.
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up     
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        

  • Hi i have a apple ipod touch 3G the power button doesnt work so i cant ever turn it off but i got home and my screen is just plain white how do i fix this thnx

    i need some help i have a 3G ipod touch the power button doesnt work at all but i got home and my screen is just plain white how do i fix this

    Let the battery fully drain. After charging for an hour try a reset (may not work).
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Then connect to your comnputer and try to restore.
    - If the screen is still white then it appears yu have a hardware problem and appointment at the Genius Bar of an Apple store is in order.

  • Submit button doesnt work in android

    Hi everyone,
    I created a form with using livecycle designer ES3 and ı added e-mail submit button.  it works in pc. However, it doesnt work in android. Other field is working ratio button, text field etc. Just submit button doesnt work. Adobe reader x installed. Also air installed. it doesnt again. Do you have any suggestion ?
    Thank you

    Moved from the Adobe Reader forum.

  • Submit button doesnt work in ipad

    I created a form with using livecycle designer ES3 and ı added e-mail submit button.  it works in pc. However, it doesnt work in ipad. Other field is working ratio button, text field etc. Just submit button doesnt work. Adobe reader x installed. Also air installed. it doesnt again. Do you have any suggestion
    Thanks

    Thank you, Gaurav Jain.
    Are there any opportunities to use submit button on pdf in iOS. Because, i can use ratio button, or any fields. My purpose is; to send pdf file with using submit button in iOS. İs this possible or is there any option for sending pdf.
    Best Regars

Maybe you are looking for

  • "Something went wrong" activating 60 min Skype wor...

    I am trying to link my Skype account with my office account to activate the 60 world minutes that are included I'm my office subscr. Always getting "sorry, something went wrong" trying since yesterday. Solved! Go to Solution.

  • Apps to create a video using a downloaded movie

    I want to make Les Miserables fan videos on my iPod. Iv'e been searching everywhere for apps that let you edit videos together using movies that I downloaded, but I can only find ones that let you edit pictures and videos from the camera roll. Are th

  • How to copy images between folders?

    Hi, Overall, I really like Lightroom, but there's one thing that's bugging me to no end. I work with a lot images, where I need real physical copies of an image on several locations on the disk (workflow reasons, automatic backup, publishing etc). It

  • Hard Drive disappears

    I can only start my PB off the install disk (it's a copy and I'm not sure if it's a copy of the exact disk that came with the machine) and it does not see the internal hard drive. When started in Target Disk mode other computers see the hard drive. I

  • My Pavillion m7760n has stopped installing windows updates, Error Code 0x80070020. Unable to find a

    my Pavillion m7760n has stopped installing windows updates, Error Code 0x80070020.  Unable to find a fix for it.