Files
HW-07-JavaFX/src/main/resources/sbu/javafx/App-view.fxml
T

82 lines
3.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Separator?>
<?import javafx.geometry.Insets?>
<VBox xmlns="http://javafx.com/fxml"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="sbu.javafx.MusicController"
alignment="CENTER"
spacing="15"
prefWidth="580"
prefHeight="380">
<padding>
<Insets top="25" right="25" bottom="25" left="25"/>
</padding>
<Label text="Music Player" style="-fx-font-size: 26; -fx-font-weight: bold;"/>
<Label fx:id="nowPlayingLabel" text="Now Playing: —"
style="-fx-font-size: 13; -fx-text-fill: #666666;"/>
<Separator/>
<GridPane hgap="12" vgap="10" alignment="CENTER">
<columnConstraints>
<ColumnConstraints minWidth="170" prefWidth="170"/>
<ColumnConstraints minWidth="120" prefWidth="120"/>
<ColumnConstraints minWidth="60" prefWidth="60"/>
<ColumnConstraints minWidth="80" prefWidth="80"/>
<ColumnConstraints minWidth="110" prefWidth="110"/>
</columnConstraints>
<!-- Header row -->
<Label text="Title" style="-fx-font-weight: bold;" GridPane.columnIndex="0" GridPane.rowIndex="0"/>
<Label text="Artist" style="-fx-font-weight: bold;" GridPane.columnIndex="1" GridPane.rowIndex="0"/>
<Label text="Duration" style="-fx-font-weight: bold;" GridPane.columnIndex="2" GridPane.rowIndex="0"/>
<!-- Song 1: Blinding Lights -->
<Label text="Blinding Lights" GridPane.columnIndex="0" GridPane.rowIndex="1"/>
<Label text="The Weeknd" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Label text="3:20" GridPane.columnIndex="2" GridPane.rowIndex="1"/>
<Button fx:id="playBtn1" text="Play" userData="Blinding Lights"
onAction="#handlePlayAction"
GridPane.columnIndex="3" GridPane.rowIndex="1"/>
<Button text="+ Playlist" userData="Blinding Lights"
onAction="#handleAddToPlaylist"
GridPane.columnIndex="4" GridPane.rowIndex="1"/>
<!-- Song 2: Shape of You -->
<Label text="Shape of You" GridPane.columnIndex="0" GridPane.rowIndex="2"/>
<Label text="Ed Sheeran" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
<Label text="3:53" GridPane.columnIndex="2" GridPane.rowIndex="2"/>
<Button fx:id="playBtn2" text="Play" userData="Shape of You"
onAction="#handlePlayAction"
GridPane.columnIndex="3" GridPane.rowIndex="2"/>
<Button text="+ Playlist" userData="Shape of You"
onAction="#handleAddToPlaylist"
GridPane.columnIndex="4" GridPane.rowIndex="2"/>
<!-- Song 3: Levitating -->
<Label text="Levitating" GridPane.columnIndex="0" GridPane.rowIndex="3"/>
<Label text="Dua Lipa" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
<Label text="3:23" GridPane.columnIndex="2" GridPane.rowIndex="3"/>
<Button fx:id="playBtn3" text="Play" userData="Levitating"
onAction="#handlePlayAction"
GridPane.columnIndex="3" GridPane.rowIndex="3"/>
<Button text="+ Playlist" userData="Levitating"
onAction="#handleAddToPlaylist"
GridPane.columnIndex="4" GridPane.rowIndex="3"/>
</GridPane>
<Separator/>
<Button text="View Playlist" onAction="#openPlaylistWindow"
style="-fx-font-size: 13; -fx-padding: 6 20 6 20;"/>
</VBox>