0
hello, I’m trying to make an application that runs a song endlessly, but when the user clicks a button the music stops , that is my code
public void tocar() {
relogio = new Timeline(new KeyFrame(Duration.ZERO, e -> {
clip.play();
}),
new KeyFrame(Duration.seconds(10))
);
relogio.setCycleCount(Animation.INDEFINITE);
relogio.play();
}
Here is the button where the Timeline clock was supposed to stop
public void eventoMusica(ActionEvent evento){
if (gettexto().equals("desligar")){
clip.stop();
relogio.stop();
botaoEvento.setText("ligar");
}
else{
tocar();
botaoEvento.setText("desligar");
}
}
but it is exactly in "clock.stop()" that I catch this exception, ?
What is the type of the clip variable? Mediaplayer?
– Fagner Fonseca