Код: Выделить всё
~/Javafx-Music-App main !2 ?2 > ./gradlew run 00:48:49
Starting a Gradle Daemon, 2 incompatible and 2 stopped Daemons could not be reused, use --status for details
Calculating task graph as no cached configuration is available for tasks: run
> Task :app:run
/home/chj/Javafx-Music-> App/app/build/resources/main/MusicPlayer/playScene.fxml:14
75% EXECUTING [2m]
> : a p p : r u n < b r / > < / c o d e > < b r / > < / b l o c k q u o t e > < b r / > < c o d e > < b r / > T h i s i s t h e f i l e t r e e o f t h e p r o j e c t < b r / > < b r / > ` ` ` l a n g - n o n e < b r / > ├ ─ ─ a p p < b r / > │ ├ ─ ─ b i n < b r / > │ │ ├ ─ ─ m a i n < b r / > │ │ │ └ ─ ─ M u s i c P l a y e r < b r / > │ │ │ ├ ─ ─ A u d i o < b r / > │ │ │ │ ├ ─ ─ p l a y e r . c l a s s < b r / > │ │ │ │ └ ─ ─ U t i l s . c l a s s < b r / > │ │ │ ├ ─ ─ b a c k w a r d . p n g < b r / > │ │ │ ├ ─ ─ e x i t V i s u a l i z e r . p n g < b r / > │ │ │ ├ ─ ─ F i l e C h o o s e r < b r / > │ │ │ │ ├ ─ ─ F i l e c h o o s e r $ 1 . c l a s s < b r / > │ │ │ │ ├ ─ ─ F i l e c h o o s e r $ 2 . c l a s s < b r / > │ │ │ │ └ ─ ─ F i l e c h o o s e r . c l a s s < b r / > │ │ │ ├ ─ ─ f o l d e r . p n g < b r / > │ │ │ ├ ─ ─ f o r w a r d . p n g < b r / > │ │ │ ├ ─ ─ h i g h V o l u m e . p n g < b r / > │ │ │ ├ ─ ─ l o w V o l u m e . p n g < b r / > │ │ │ ├ ─ ─ M a i n . c l a s s < b r / > │ │ │ ├ ─ ─ p a u s e . p n g < b r / > │ │ │ ├ ─ ─ p l a y l i s t C o n s e c u t i v e . p n g < b r / > │ │ │ ├ ─ ─ p l a y l i s t S h u f f l e . p n g < b r / > │ │ │ ├ ─ ─ p l a y . p n g < b r / > │ │ │ ├ ─ ─ p l a y S c e n e . f x m l < b r / > │ │ │ ├ ─ ─ p l u s . p n g < b r / > │ │ │ ├ ─ ─ p r o g r e s s S l i d e r S t y l e . c s s < b r / > │ │ │ ├ ─ ─ r e p e a t . p n g < b r / > │ │ │ ├ ─ ─ r epeatSong.png
│ │ │ ├── ui
│ │ │ │ ├── Main.class
│ │ │ │ ├── PlayScene.class
│ │ │ │ ├── Visualizer$1.class
│ │ │ │ └── Visualizer.class
│ │ │ ├── viewQueue.png
│ │ │ ├── Visualizer.fxml
│ │ │ ├── visualizer.png
│ │ │ └── volumeSliderStyle.css
│ │ └── test
│ │ └── org
│ │ └── example
│ │ └── AppTest.class
│ ├── build
│ │ ├── classes
│ │ │ └── java
│ │ │ └── main
│ │ │ └── MusicPlayer
│ │ │ ├── Audio
│ │ │ │ ├── player.class
│ │ │ │ └── Utils.class
│ │ │ ├── FileChooser
│ │ │ │ ├── Filechooser$1.class
│ │ │ │ ├── Filechooser$2.class
│ │ │ │ └── Filechooser.class
│ │ │ ├── Main.class
│ │ │ └── ui
│ │ │ ├── Main.class
│ │ │ ├── PlayScene.class
│ │ │ ├── Visualizer$1.class
│ │ │ └── Visualizer.class
│ │ ├── generated
│ │ │ └── sources
│ │ │ ├── annotationProcessor
│ │ │ │ └── java
│ │ │ │ └── main
│ │ │ └── headers
│ │ │ └── java
│ │ │ └── main
│ │ ├── resources
│ │ │ └── main
│ │ │ └── MusicPlayer
│ │ │ ├── backward.png
│ │ │ ├── exitVisualizer.png
│ │ │ ├── folder.png
│ │ │ ├── forward.png
│ │ │ ├── highVolume.png
│ │ │ ├── lowVolume.png
│ │ │ ├── pause.png
│ │ │ ├── playlistConsecutive.png
│ │ │ ├── playlistShuffle.png
│ │ │ ├── play.png
│ │ │ ├── playScene.fxml
│ │ │ ├── plus.png
│ │ │ ├── progressSliderStyle.css
│ │ │ ├── repeat.png
│ │ │ ├── repeatSong.png
│ │ │ ├── viewQueue.png
│ │ │ ├── Visualizer.fxml
│ │ │ ├── visualizer.png
│ │ │ └── volumeSliderStyle.css
│ │ └── tmp
│ │ └── compileJava
│ │ ├── compileTransaction
│ │ │ ├── backup-dir
│ │ │ └── stash-dir
│ │ │ └── Main.class.uniqueId0
│ │ └── previous-compilation-data.bin
│ ├── build.gradle.kts
│ └── src
│ ├── main
│ │ ├── java
│ │ │ └── MusicPlayer
│ │ │ ├── Audio
│ │ │ │ ├── player.java
│ │ │ │ └── Utils.java
│ │ │ ├── FileChooser
│ │ │ │ └── Filechooser.java
│ │ │ ├── Main.java
│ │ │ └── ui
│ │ │ ├── Main.java
│ │ │ ├── PlayScene.java
│ │ │ └── Visualizer.java
│ │ └── resources
│ │ └── MusicPlayer
│ │ ├── backward.png
│ │ ├── exitVisualizer.png
│ │ ├── folder.png
│ │ ├── forward.png
│ │ ├── highVolume.png
│ │ ├── lowVolume.png
│ │ ├── pause.png
│ │ ├── playlistConsecutive.png
│ │ ├── playlistShuffle.png
│ │ ├── play.png
│ │ ├── playScene.fxml
│ │ ├── plus.png
│ │ ├── progressSliderStyle.css
│ │ ├── repeat.png
│ │ ├── repeatSong.png
│ │ ├── viewQueue.png
│ │ ├── Visualizer.fxml
│ │ ├── visualizer.png
│ │ └── volumeSliderStyle.css
│ └── test
│ └── java
│ └── org
│ └── example
│ └── AppTest.java
├── gradle
│ ├── libs.versions.toml
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── kls_database.db
├── README.md
└── settings.gradle.kts
< /code>
И это build.gradle.kts < /p>
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
application
java
id("org.openjfx.javafxplugin") version "0.1.0"
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
dependencies {
// Use JUnit Jupiter for testing.
testImplementation(libs.junit.jupiter)
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// This dependency is used by the application.
implementation(libs.guava)
implementation(libs.gstreamer.java)
implementation ("net.java.dev.jna:jna:5.10.0")
implementation ("net.java.dev.jna:jna-platform:5.10.0")
implementation("org.freedesktop.gstreamer:gst1-java-fx:0.9.0")
}
// Apply a specific Java toolchain to ease working on different environments.
java { toolchain { languageVersion = JavaLanguageVersion.of(21) } }
javafx {
version = "21.0.7"
modules = listOf("javafx.controls", "javafx.fxml")
}
application {
// Define the main class for the application.
mainClass = "MusicPlayer.Main"
}
tasks.named("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
< /code>
Это Musicplayer.main < /p>
package MusicPlayer;
import MusicPlayer.Audio.player;
import java.io.File;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
* Main
*/
public class Main extends Application {
public void start(Stage primaryStage) throws Exception {
try {
Parent root = FXMLLoader.load(getClass().getResource("playScene.fxml"));
primaryStage.setTitle("Music Player");
Scene scene = new Scene(root, 700, 700);
primaryStage.setScene(scene);
primaryStage.show();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public static void main(String[] args) {
launch(args);
}
}
< /code>
Это playscene.fxml: < /p>
-fx-background-color: rgba(0, 0, 0, 0);
-fx-background-radius: 17;
-fx-border-width: 0;
-fx-shape: 'M17,0 A17,17 0 1,1 16.99,0 Z';
-fx-padding: 0;
-fx-scale-shape: false;
-fx-background-color: rgba(0, 0, 0, 0.1);
-fx-background-radius: 17;
-fx-border-width: 0;
-fx-shape: 'M17,0 A17,17 0 1,1 16.99,0 Z';
-fx-padding: 0;
-fx-scale-shape: false;
-fx-background-color: rgba(0, 0, 0, 0.1);
-fx-background-radius: 21;
-fx-border-width: 0;
-fx-shape: 'M21,0 A21,21 0 1,1 20.99,0 Z';
-fx-padding: 0;
-fx-scale-shape: false;
-fx-background-color: rgba(0, 0, 0, 0.1);
-fx-background-radius: 17;
-fx-border-width: 0;
-fx-shape: 'M17,0 A17,17 0 1,1 16.99,0 Z';
-fx-padding: 0;
-fx-scale-shape: false;
-fx-background-color: rgba(0, 0, 0, 0.1);
-fx-background-radius: 17;
-fx-border-width: 0;
-fx-shape: 'M17,0 A17,17 0 1,1 16.99,0 Z';
-fx-padding: 0;
-fx-scale-shape: false;
-fx-background-color: rgba(0, 0, 0, 0.1);
-fx-background-radius: 17;
-fx-border-width: 0;
-fx-shape: 'M17,0 A17,17 0 1,1 16.99,0 Z';-fx-padding: 0; -fx-scale-shape: false;
-fx-background-color: rgba(0, 0, 0, 0.1);
-fx-background-radius: 17;
-fx-border-width: 0;
-fx-shape: 'M17,0 A17,17 0 1,1 16.99,0 Z';
-fx-padding: 0;
-fx-scale-shape: false;
Подробнее здесь: https://stackoverflow.com/questions/796 ... er-machine