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.
Instalar e Configurar o Slackware Linux em 2025
Como configurar os repositórios do apt no Debian 12 em 2025
Passkeys: A Evolução da Autenticação Digital
Instalação de distro Linux em computadores, netbooks, etc, em rede com o Clonezilla
Como colorir os logs do terminal com ccze
Instalação Microsoft Edge no Linux Mint 22
Como configurar posicionamento e movimento de janelas no Lubuntu (Openbox) com atalhos de teclado
Máquinas Virtuais com IP estático acessando Internet no Virtualbox
Meus HDs não aparecem mais no boot da placa mãe (12)
Acabei zuando meu Linux inteiro e estou desesperado (10)
Linux Mint com GForce 630 e 2 monitores dos quais só um está na resolu... (2)