Enviado em 10/10/2021 - 16:30h
É o seguinte, estou tentando fazer um projeto javaFX que toca uma música do meu pc e sorteia números aleatórios com a mensagem "Hacking NASA" + numeroAleatorio.package com.example.demo1;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import java.io.File;
import java.util.Random;
import java.util.concurrent.TimeUnit;
public class HeckerVibes {
public static void main(String[] args) throws InterruptedException {
Random r = new Random();
int y = r.nextInt(25);
audio();
System.out.println("Hacking NASA... " + y + "%");
y = r.nextInt(50);
while(y < 25){
y = r.nextInt(50);
}
System.out.println("Hacking NASA... " + y + "%");
int h = r.nextInt(5) + 1;
TimeUnit.SECONDS.sleep(h);
y = r.nextInt(75);
while(y < 50){
y = r.nextInt(75);
}
System.out.println("Hacking NASA... " + y + "%");
h = r.nextInt(5) + 1;
TimeUnit.SECONDS.sleep(h);
y = r.nextInt(100);
while(y < 75){
y = r.nextInt(100);
}
System.out.println("Hacking NASA... " + y + "%");
h = r.nextInt(5) + 1;
TimeUnit.SECONDS.sleep(h);
System.out.println("Hacking NASA... 99%");
TimeUnit.SECONDS.sleep(1);
System.out.println("NASA hacked");
}
public static void audio(){
String kimo = "~/Music/musica.mp3";
Media hit = new Media(new File(kimo).toURI().toString());
MediaPlayer media = new MediaPlayer(hit);
media.play();
}
}
'javafx.media'na seção modules, isso não parece ser o erro.
Atenção a quem posta conteúdo de dicas, scripts e tal (2)
Criando um gateway de internet com o Debian
Configuração básica do Conky para mostrar informações sobre a sua máquina no Desktop
Aprenda a criar músicas com Inteligência Artificial usando Suno AI
Entendendo o que é URI, URL, URN e conhecendo as diferenças entre POST e GET
Ativando o Modo Noturno via Linha de Comando no GNOME/Wayland
Preparando pendrive com GNU/Linux [Corretamente!]
Instalando Google Chrome no Fedora 40
Habilitando a importação de senhas no Firefox
Como corrigir o erro do VirtualBox travar a máquina virtual em tela cheia
Virtual Host no Webmin [PHP] (1)
Navegadores com linhas na tela (2)
Acesso remoto via SSH por Script numa virtualbox (2)