Solved

Java Sound Problems............

Posted on 2002-04-11
5
172 Views
Last Modified: 2011-09-20
As far as i can see this code is correct but the sound is not being played when the button is pressed!

here is all the code involved

public void mousePressed(MouseEvent event)
{
Object source = event.getSource();
if (source == cotbuttons[0])
{
earlyactivitiescount++;
cotbuttons[0].removeMouseListener(this);
WellDoneSound();
}
}

public void WellDoneSound()
{
try
{
URL welldoneurl = new URL("file://C:/Java/FYP/sounds/welcome.wav");
AudioClip welldoneclip = JApplet.newAudioClip(welldoneurl);
welldoneclip.play();
}
catch (MalformedURLException e){}
}


please help if you can!!!!!!!!!

thank you
 
 


0
Comment
Question by:Codster
  • 2
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
Venci75 earned 10 total points
ID: 6933789
It is OK, but probably the code inside the if(source == cotbuttons[0]) is not executed.

PS:
What about the
http://www.experts-exchange.com/java/Q.20287396.html
0
 

Author Comment

by:Codster
ID: 6933929
the code is being executed all right have System.out.println("xxxx"); statements everywhere
the import java.net.URL; statement is ok as well
everything seems to be executing only the sound is not being played.

Why do  i not need import javax.sound etc etc?
the file type i am using is a .wav
is there anything involved in that that i have omitted?
0
 
LVL 92

Expert Comment

by:objects
ID: 6935363
The answer to your previous question obviously answered your question, so award the points to Venci75.
0
 
LVL 92

Expert Comment

by:objects
ID: 6935397
I meant the previous question, not this one :)
0
 

Author Comment

by:Codster
ID: 6935401
Thank you
i will award him the points
can you help me with my problem at all?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
eclipse shortcuts 9 63
object oriented programming comparison 5 77
servlet example 17 53
Eclipse Java import and method not resolved 4 50
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question