how to play audio track in java applat

how to play audio track in java applat

Sir,i took help of coding in how to play audio track in java applet....nd i found perfect code ..but when i run same code on net beans then it shows error that could not found main class file...as u see there is no main claas in this coding then how would i run dis code...and the code is

import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class PlayAppletSound extends Applet implements ActionListener{
  Button play,stop;
  AudioClip audioClip;

  public void init(){
  play = new Button("  Play in Loop  ");
  add(play);
  play.addActionListener(this);
  stop = new Button("  Stop  ");
  add(stop);
  stop.addActionListener(this);
  audioClip = getAudioClip(getCodeBase(), "TestSnd.wav");
  }

    @Override
  public void actionPerformed(ActionEvent ae){
  Button source = (Button)ae.getSource();
  if (  "  Play in Loop  ".equals(source.getLabel())){
  audioClip.play();
  }
  else if("  Stop  ".equals(source.getLabel())){
  audioClip.stop();
  }
  }

}
View Answers

September 5, 2011 at 12:09 PM

Applets always run on browser.

To compile a program in NetBeans, select Build->Compile from the menu. Alternatively, you can hit the F9 keyboard shortcut. If the compilation is successful, a message "Finished program name" appears in the Output Window.

If you supply an HTML file for your applet, you can launch a browser window from NetBeans to view the applet. Locate the HTML file in the file system explorer and click on it with the right mouse button. Select View from the menu. Your browser is launched and displays the result on the browser.

Ads









Related Tutorials/Questions & Answers:
how to play audio track in java applat
how to play audio track in java applat  Sir,i took help of coding in how to play audio track in java applet....nd i found perfect code ..but when i... file...as u see there is no main claas in this coding then how would i run dis
Play Audio in Java Applet
the sound file. This program will show you how to play a audio clip in your java applet... Play Audio in Java Applet      ... is used to play the sound while stop() method is used for stop the running audio
Advertisements
Java how to stop audio
Java how to stop audio  hello i have this code in the main: try { AudioInputStream audio = AudioSystem.getAudioInputStream(new File...(audio); clip.start(); } catch
how to stop audio (mp3)
how to stop audio (mp3)   if(e.getActionCommand(). equals("Stop")){ player.stop(); } i am making an audio player in which i... stopping it. how should i stop the song keeping in mind i have to play another song
how to add audio clip in swings with event handling
how to add audio clip in swings with event handling  hello dear, i wanna to play audio clip in java program in JFrame in swings by event handling ,it should be like when i click on a button , audio clip should play , plz tell me
how to run audio files in net beans using j2me
how to run audio files in net beans using j2me  i am running the audioMidlet in net beans. Now where should i place the .wav files inorder to play them
How to Track Website Traffic?
that actually translates into your website revenue. Thus to track website traffic... or measure your website standing in the overall competition. To track website... and popular online mechanism to track website traffic. You can assume Google's
How to track how many hits my website gets?
How to track how many hits my website gets?  Hi, Tracking a website... the website traffic. Tell me How to track how many hits my website gets? Thanks... traffic. Check the tutorial How do I track how many hits my website gets. Thanks
How to Remove audio from video file with FFmpeg?
How to Remove audio from video file with FFmpeg?  I have a video... in video. How to remove audio from video file with FFmpeg? thanks   Hi, You can use the '-an' option to remove the audio from video. Check
Audio MIDlet Example
Audio MIDlet Example       This example illustrates how to play audio songs in your... a player for an audio song by using of javax.microedition.media API. As you
HTML5 audio reference
HTML5 audio reference  Hi, Tell me the best url to learn HTML5 audio tags with examples. Thanks   Hi, Learn how to use HTML5 audio tags to play the audio on web page. The HTML5 audio tag is used to play the video
track array declaration
track array declaration  how to track an array declaration in a input program
track file size changes
track file size changes  How to track a change in file size
How to play radio station on iPhone
How to play radio station on iPhone  how to play radio station on iphone
Maven dependency for be.yildiz-games - module-audio version 2.0.0 is released. Learn to use module-audio version 2.0.0 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 2.0.0 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 1.0.1 is released. Learn to use module-audio version 1.0.1 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 1.0.1 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 1.0.0 is released. Learn to use module-audio version 1.0.0 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 1.0.0 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 1.0.2 is released. Learn to use module-audio version 1.0.2 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 1.0.2 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 1.0.3 is released. Learn to use module-audio version 1.0.3 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 1.0.3 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 1.0.4 is released. Learn to use module-audio version 1.0.4 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 1.0.4 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 1.0.5 is released. Learn to use module-audio version 1.0.5 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 1.0.5 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 1.0.6 is released. Learn to use module-audio version 1.0.6 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 1.0.6 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 1.0.7 is released. Learn to use module-audio version 1.0.7 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 1.0.7 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 1.0.8 is released. Learn to use module-audio version 1.0.8 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 1.0.8 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 1.0.9 is released. Learn to use module-audio version 1.0.9 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 1.0.9 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 2.0.1 is released. Learn to use module-audio version 2.0.1 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 2.0.1 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 2.0.2 is released. Learn to use module-audio version 2.0.2 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 2.0.2 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 2.0.3 is released. Learn to use module-audio version 2.0.3 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 2.0.3 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 2.0.4 is released. Learn to use module-audio version 2.0.4 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 2.0.4 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 2.0.5 is released. Learn to use module-audio version 2.0.5 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 2.0.5 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio
Maven dependency for be.yildiz-games - module-audio version 2.0.6 is released. Learn to use module-audio version 2.0.6 in Maven based Java projects
) in their Java project if it is based on Maven and Gradle. How to use  be.yildiz-games... - module-audio version 2.0.6 in Java projects. Follow the step by step tutorial...-audio released The developers of   be.yildiz-games - module-audio

Ads