Solved

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

Posted on 2002-04-11
5
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

734 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