Ayuda
Publicado por Rafael (1 intervención) el 11/12/2012 16:34:53
Hola buen día.
A quien me pueda ayudar muchisimas gracias.
Me sucede que cree un codigo en java para reproducir una musica, la misma la quiero controlar por botones, cree los botones pero no funcionan:
import java.awt.Button;
import java.awt.Event;
import java.awt.Graphics;
import java.applet.Applet;
import java.applet.AudioClip;
public class prueba3 extends Applet {
AudioClip sonido;
public void start() {
sonido.loop();
}
public void stop() {
sonido.stop();
}
Button b1, b2, b3;
public void init() {
sonido = getAudioClip( getDocumentBase(),"Kalimba.au" );
}
public void paint( Graphics g ) {
g.drawString( "Prueba de Repetición",25,25 );
b1 = new Button ("Play");
b2 = new Button ("Loop");
b3 = new Button ("Stop");
this.add( b1 );
this.add( b2 );
this.add( b3 );
}
public boolean acction (Event e, Object o){
if (e. target == b1)
sonido.play();
else if (e. target == b2)
sonido.loop ();
else if (e. target == b3)
sonido.stop();
return true;
}}
A quien me pueda ayudar muchisimas gracias.
Me sucede que cree un codigo en java para reproducir una musica, la misma la quiero controlar por botones, cree los botones pero no funcionan:
import java.awt.Button;
import java.awt.Event;
import java.awt.Graphics;
import java.applet.Applet;
import java.applet.AudioClip;
public class prueba3 extends Applet {
AudioClip sonido;
public void start() {
sonido.loop();
}
public void stop() {
sonido.stop();
}
Button b1, b2, b3;
public void init() {
sonido = getAudioClip( getDocumentBase(),"Kalimba.au" );
}
public void paint( Graphics g ) {
g.drawString( "Prueba de Repetición",25,25 );
b1 = new Button ("Play");
b2 = new Button ("Loop");
b3 = new Button ("Stop");
this.add( b1 );
this.add( b2 );
this.add( b3 );
}
public boolean acction (Event e, Object o){
if (e. target == b1)
sonido.play();
else if (e. target == b2)
sonido.loop ();
else if (e. target == b3)
sonido.stop();
return true;
}}
Valora esta pregunta


0