I created the basic UI of the music player.

This commit is contained in:
Matin
2026-05-29 21:05:35 +04:30
parent fa5f8ab267
commit 2b5af885c9
5 changed files with 103 additions and 4 deletions
Generated
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
+7 -1
View File
@@ -3,6 +3,12 @@ package sbu.javafx;
import javafx.application.Application;
public class Launcher {
public static void main(String[] args) {
// TODO: Launch the JavaFX application by calling Application.launch(Main.class) }
Application.launch(MusicApp.class ,args);
}
}
+1
View File
@@ -16,6 +16,7 @@ public class MusicApp extends Application {
Scene scene = new Scene(fxmlLoader.load());
stage.setTitle("Music Player");
stage.setScene(scene);
//TODO: add icon to the stage
stage.show();
}
@@ -2,6 +2,7 @@ package sbu.javafx;
import javafx.fxml.FXML;
import javafx.event.ActionEvent;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
@@ -12,6 +13,11 @@ public class MusicController {
//TODO: Implement the logic to play a song. This method should update the UI to show which song is currently playing.
public Button button ;
public void OnAction()
{
System.out.println("click on submit");
}
@FXML
public void handlePlayAction() {
//Update labels, change button icons, etc.
+81 -2
View File
@@ -1,8 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<VBox xmlns="http://javafx.com/fxml" alignment="CENTER" spacing="10">
<?import javafx.scene.shape.Rectangle?>
<VBox alignment="CENTER" xmlns="http://javafx.com/javafx/26" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label alignment="CENTER" prefHeight="23.0" prefWidth="576.0" text="Music Player">
<font>
<Font name="Mongolian Baiti" size="20.0" />
</font>
</Label>
<HBox prefHeight="0.0" prefWidth="578.0">
<children>
<AnchorPane prefHeight="54.0" prefWidth="577.0">
<children>
<Label layoutX="370.0" layoutY="8.0" prefHeight="18.0" prefWidth="86.0" text="Add To PlayList" />
<Label layoutX="270.0" layoutY="8.0" text="Duration " />
<Label layoutX="523.0" layoutY="8.0" text="play" />
<Label layoutX="148.0" layoutY="8.0" prefHeight="18.0" prefWidth="74.0" text="Artist Name" />
<Label layoutX="43.0" layoutY="8.0" text="Song Title" />
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#ffffff00" height="34.0" layoutX="7.0" stroke="BLACK" strokeType="INSIDE" width="567.0" />
</children>
</AnchorPane>
</children>
</HBox>
<HBox prefHeight="64.0" prefWidth="578.0">
<children>
<AnchorPane prefHeight="65.0" prefWidth="578.0">
<children>
<Label layoutX="32.0" layoutY="23.0" text="Song of Dawn" />
<Label layoutX="169.0" layoutY="23.0" text="Alice" />
<Label layoutX="376.0" layoutY="23.0" text="Add To Playlist" />
<Label layoutX="275.0" layoutY="23.0" text="03:45" />
<Label layoutX="524.0" layoutY="23.0" text="Play" />
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#1f93ff00" height="48.0" layoutX="7.0" layoutY="8.0" stroke="BLACK" strokeType="INSIDE" width="567.0" />
</children>
</AnchorPane>
</children>
</HBox>
</children>
<HBox prefHeight="64.0" prefWidth="578.0">
<children>
<AnchorPane prefHeight="65.0" prefWidth="578.0">
<children>
<Label layoutX="32.0" layoutY="23.0" text="Night Drive" />
<Label layoutX="169.0" layoutY="23.0" text="John" />
<Label layoutX="376.0" layoutY="23.0" text="Add To Playlist" />
<Label layoutX="275.0" layoutY="23.0" text="04:12" />
<Label layoutX="524.0" layoutY="23.0" text="Play" />
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#1f93ff00" height="48.0" layoutX="7.0" layoutY="8.0" stroke="BLACK" strokeType="INSIDE" width="567.0" />
</children>
</AnchorPane>
</children>
</HBox>
<HBox prefHeight="64.0" prefWidth="578.0">
<children>
<AnchorPane prefHeight="65.0" prefWidth="578.0">
<children>
<Label layoutX="32.0" layoutY="23.0" text="Lost Sky" />
<Label layoutX="169.0" layoutY="23.0" text="Emma" />
<Label layoutX="376.0" layoutY="23.0" text="Add To Playlist" />
<Label layoutX="275.0" layoutY="23.0" text="02:55" />
<Label layoutX="524.0" layoutY="23.0" text="Play" />
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#1f93ff00" height="48.0" layoutX="7.0" layoutY="8.0" stroke="BLACK" strokeType="INSIDE" width="567.0" />
</children>
</AnchorPane>
</children>
</HBox>
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<AnchorPane prefHeight="200.0" prefWidth="200.0">
<children>
<Label layoutX="32.0" layoutY="50.0" text="Now Play :" />
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#ffffff00" height="64.0" layoutX="8.0" layoutY="27.0" stroke="BLACK" strokeType="INSIDE" width="567.0" />
</children>
</AnchorPane>
</children>
</HBox>
<!-- TODO: Add your code here! -->
</VBox>