JavaFX Music Player Project

This commit is contained in:
2026-05-29 22:35:56 +03:30
parent 772c9ed3f6
commit 5fcfe8a953
6 changed files with 452 additions and 124 deletions
+270 -62
View File
@@ -5,6 +5,8 @@ import javafx.scene.Scene;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.ListView; import javafx.scene.control.ListView;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.scene.media.Media; import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer; import javafx.scene.media.MediaPlayer;
@@ -24,10 +26,31 @@ public class MusicController
@FXML private Button playBtn2; @FXML private Button playBtn2;
@FXML private Button playBtn3; @FXML private Button playBtn3;
@FXML private ImageView playIcon1;
@FXML private ImageView playIcon2;
@FXML private ImageView playIcon3;
@FXML private Button stopBtn1;
@FXML private Button stopBtn2;
@FXML private Button stopBtn3;
private final List<String> playlist = new ArrayList<>(); private final List<String> playlist = new ArrayList<>();
private MediaPlayer mediaPlayer; private MediaPlayer mediaPlayer;
private boolean darkTheme = false; private boolean darkTheme = false;
private String currentPlayingSongFile = null;
private boolean isPlaying = false;
private boolean isSong1Playing = false;
private boolean isSong2Playing = false;
private boolean isSong3Playing = false;
private Image playImage;
private Image pauseImage;
private Image stopImage;
private final String song1 = "Careless Whisper"; private final String song1 = "Careless Whisper";
private final String song2 = "Adore You"; private final String song2 = "Adore You";
private final String song3 = "Wildflower"; private final String song3 = "Wildflower";
@@ -37,42 +60,40 @@ public class MusicController
private final String song3File = "/sbu/javafx/audio/wildflower.mp3"; private final String song3File = "/sbu/javafx/audio/wildflower.mp3";
@FXML @FXML
private void initialize() {updateNowPlaying("None");applyLightTheme();} private void initialize()
{
playImage = loadImage("/sbu/javafx/images/play.png");
pauseImage = loadImage("/sbu/javafx/images/pause.png");
stopImage = loadImage("/sbu/javafx/images/stop.png");
@FXML updateAllButtonIcons();
public void handlePlay1() {playSong(song1, song1File, playBtn1);} updateNowPlaying("None");
applyLightTheme();
}
@FXML @FXML public void handlePlay1() { togglePlay(song1, song1File, playIcon1, 1); }
public void handlePlay2() {playSong(song2, song2File, playBtn2);} @FXML public void handlePlay2() { togglePlay(song2, song2File, playIcon2, 2); }
@FXML public void handlePlay3() { togglePlay(song3, song3File, playIcon3, 3); }
@FXML @FXML public void handleStop1() { stopSong(1); }
public void handlePlay3() {playSong(song3, song3File, playBtn3);} @FXML public void handleStop2() { stopSong(2); }
@FXML public void handleStop3() { stopSong(3); }
@FXML @FXML public void handleAdd1() { addToPlaylist(song1); }
public void handleAdd1() {addToPlaylist(song1);} @FXML public void handleAdd2() { addToPlaylist(song2); }
@FXML public void handleAdd3() { addToPlaylist(song3); }
@FXML
public void handleAdd2() {addToPlaylist(song2);}
@FXML
public void handleAdd3() {addToPlaylist(song3);}
@FXML @FXML
public void handleViewPlaylist() public void handleViewPlaylist()
{ {
Stage stage = new Stage(); Stage stage = new Stage();
VBox root = new VBox(10); VBox root = new VBox(10);
root.setStyle("-fx-padding: 16; -fx-background-color: white;"); root.setStyle("-fx-padding: 16; -fx-background-color: white;");
Label title = new Label("My Playlist"); Label title = new Label("My Playlist");
title.setStyle("-fx-font-size: 18px; -fx-font-weight: bold;"); title.setStyle("-fx-font-size: 18px; -fx-font-weight: bold;");
ListView<String> listView = new ListView<>(); ListView<String> listView = new ListView<>();
listView.getItems().addAll(playlist); listView.getItems().addAll(playlist);
root.getChildren().addAll(title, listView); root.getChildren().addAll(title, listView);
Scene scene = new Scene(root, 300, 400); Scene scene = new Scene(root, 300, 400);
stage.setScene(scene); stage.setScene(scene);
stage.setTitle("Playlist"); stage.setTitle("Playlist");
@@ -83,14 +104,47 @@ public class MusicController
public void handleToggleTheme() public void handleToggleTheme()
{ {
darkTheme = !darkTheme; darkTheme = !darkTheme;
if (darkTheme) applyDarkTheme(); else applyLightTheme();
if (darkTheme) {applyDarkTheme();}
else {applyLightTheme();}
} }
private void playSong(String songName, String resourcePath, Button playButton) private void togglePlay(String songName, String resourcePath, ImageView icon, int songIndex)
{
boolean shouldPlay = false;
switch(songIndex)
{
case 1: shouldPlay = !isSong1Playing; break;
case 2: shouldPlay = !isSong2Playing; break;
case 3: shouldPlay = !isSong3Playing; break;
}
if (shouldPlay)
{
playOrResumeSong(songName, resourcePath, icon, songIndex);
}
else
{
pauseSong(songIndex);
}
updateAllButtonIcons();
}
private void playOrResumeSong(String songName, String resourcePath, ImageView icon, int songIndex)
{ {
try try
{
if (mediaPlayer != null && isPlaying && !resourcePath.equals(currentPlayingSongFile))
{
stopPlayback();
updateAllButtonIcons();
}
if (mediaPlayer != null && !isPlaying && resourcePath.equals(currentPlayingSongFile))
{
mediaPlayer.play();
isPlaying = true;
}
else
{ {
if (mediaPlayer != null) if (mediaPlayer != null)
{ {
@@ -102,75 +156,229 @@ public class MusicController
if (url == null) if (url == null)
{ {
updateNowPlaying(songName + " (file not found)"); updateNowPlaying(songName + " (file not found)");
setSongStatus(songIndex, false);
return; return;
} }
Media media = new Media(url.toExternalForm()); Media media = new Media(url.toExternalForm());
mediaPlayer = new MediaPlayer(media); mediaPlayer = new MediaPlayer(media);
currentPlayingSongFile = resourcePath;
isPlaying = true;
mediaPlayer.setOnEndOfMedia(() ->
{
stopPlayback();
updateNowPlaying("None");
setSongStatus(songIndex, false);
updateAllButtonIcons();
});
mediaPlayer.setOnError(() ->
{
stopPlayback();
updateNowPlaying(songName + " (error)");
setSongStatus(songIndex, false);
updateAllButtonIcons();
});
mediaPlayer.play(); mediaPlayer.play();
}
setSongStatus(songIndex, true);
updateNowPlaying(songName); updateNowPlaying(songName);
if (playBtn1 != null) playBtn1.setText("Play");
if (playBtn2 != null) playBtn2.setText("Play");
if (playBtn3 != null) playBtn3.setText("Play");
if (playButton != null) {playButton.setText("Playing");}
} }
catch (Exception e) catch (Exception e)
{ {
stopPlayback();
updateNowPlaying(songName + " (error)"); updateNowPlaying(songName + " (error)");
setSongStatus(songIndex, false);
e.printStackTrace(); e.printStackTrace();
} }
} }
private void addToPlaylist(String songName) private void pauseSong(int songIndex)
{ {
if (!playlist.contains(songName)) {playlist.add(songName);} if (mediaPlayer != null && isPlaying && currentPlayingSongFile != null)
{
String targetFile = "";
switch(songIndex)
{
case 1: targetFile = song1File; break;
case 2: targetFile = song2File; break;
case 3: targetFile = song3File; break;
}
if (currentPlayingSongFile.equals(targetFile))
{
mediaPlayer.pause();
isPlaying = false;
setSongStatus(songIndex, false);
updateNowPlaying("Paused: " + getSongNameByIndex(songIndex));
updateAllButtonIcons();
}
}
}
private void stopSong(int songIndex)
{
if (mediaPlayer != null && isPlaying)
{
String targetFile = "";
switch(songIndex)
{
case 1: targetFile = song1File; break;
case 2: targetFile = song2File; break;
case 3: targetFile = song3File; break;
}
if (currentPlayingSongFile != null && currentPlayingSongFile.equals(targetFile))
{
mediaPlayer.stop();
mediaPlayer.dispose();
mediaPlayer = null;
isPlaying = false;
currentPlayingSongFile = null;
setSongStatus(songIndex, false);
updateNowPlaying("None");
updateAllButtonIcons();
}
else
{
setSongStatus(songIndex, false);
updateAllButtonIcons();
}
}
else
{
setSongStatus(songIndex, false);
updateAllButtonIcons();
}
}
private void stopPlayback()
{
try
{
if (mediaPlayer != null)
{
mediaPlayer.stop();
mediaPlayer.dispose();
mediaPlayer = null;
}
}
catch (Exception ignored) { }
isPlaying = false;
currentPlayingSongFile = null;
isSong1Playing = false;
isSong2Playing = false;
isSong3Playing = false;
}
private void setSongStatus(int songIndex, boolean status)
{
switch(songIndex)
{
case 1: isSong1Playing = status; break;
case 2: isSong2Playing = status; break;
case 3: isSong3Playing = status; break;
}
}
private boolean getSongStatus(int songIndex)
{
switch(songIndex)
{
case 1: return isSong1Playing;
case 2: return isSong2Playing;
case 3: return isSong3Playing;
default: return false;
}
}
private String getSongNameByIndex(int songIndex)
{
switch(songIndex)
{
case 1: return song1;
case 2: return song2;
case 3: return song3;
default: return "Unknown";
}
}
public void addToPlaylist(String songName)
{
if (!playlist.contains(songName))
{
playlist.add(songName);
System.out.println(songName + " added to playlist.");
}
else
{
System.out.println(songName + " is already in the playlist.");
}
} }
private void updateNowPlaying(String text) private void updateNowPlaying(String text)
{ {
if (nowPlayingLabel != null) if (nowPlayingLabel != null) {nowPlayingLabel.setText("Now Playing: " + text);}
}
private void updateAllButtonIcons()
{ {
nowPlayingLabel.setText("Now Playing: " + text); updateIconButton(playIcon1, isSong1Playing, song1File);
updateIconButton(playIcon2, isSong2Playing, song2File);
updateIconButton(playIcon3, isSong3Playing, song3File);
}
private void updateIconButton(ImageView icon, boolean isPlayingCurrent, String currentSongFile)
{
if (icon == null) return;
if (isPlaying && currentPlayingSongFile != null && currentPlayingSongFile.equals(currentSongFile))
{
if (icon.getImage() != pauseImage) {icon.setImage(pauseImage);}
}
else
{
if (icon.getImage() != playImage) {icon.setImage(playImage);}
}
}
private Image loadImage(String resourcePath)
{
try
{
URL url = getClass().getResource(resourcePath);
if (url == null)
{
System.err.println("Image not found: " + resourcePath);
return null;
}
return new Image(url.toExternalForm());
}
catch (Exception e)
{
System.err.println("Error loading image: " + resourcePath + " - " + e.getMessage());
return null;
} }
} }
private void applyDarkTheme() private void applyDarkTheme()
{ {
if (rootPane != null) if (rootPane != null) rootPane.setStyle("-fx-padding: 24; -fx-background-color: #121212;");
{ if (titleLabel != null) titleLabel.setStyle("-fx-font-size: 26px; -fx-font-weight: bold; -fx-text-fill: white;");
rootPane.setStyle("-fx-padding: 24;" + "-fx-background-color: #121212;"); if (nowPlayingLabel != null) nowPlayingLabel.setStyle("-fx-padding: 12;" + "-fx-background-color: #1E1E1E;" + "-fx-background-radius: 10;" + "-fx-border-color: #444444;" + "-fx-border-radius: 10;" + "-fx-text-fill: white;");
}
if (titleLabel != null)
{
titleLabel.setStyle("-fx-font-size: 26px;" + "-fx-font-weight: bold;" + "-fx-text-fill: white;");
}
if (nowPlayingLabel != null)
{
nowPlayingLabel.setStyle("-fx-padding: 12;" + "-fx-background-color: #1E1E1E;" + "-fx-background-radius: 10;" + "-fx-border-color: #444444;" + "-fx-border-radius: 10;" + "-fx-text-fill: white;");
}
} }
private void applyLightTheme() private void applyLightTheme()
{ {
if (rootPane != null) if (rootPane != null) rootPane.setStyle("-fx-padding: 24; -fx-background-color: #F8F8F8;");
{ if (titleLabel != null) titleLabel.setStyle("-fx-font-size: 26px; -fx-font-weight: bold; -fx-text-fill: #222222;");
rootPane.setStyle("-fx-padding: 24;" + "-fx-background-color: #F8F8F8;"); if (nowPlayingLabel != null) nowPlayingLabel.setStyle("-fx-padding: 12;" + "-fx-background-color: white;" + "-fx-background-radius: 10;" + "-fx-border-color: rgba(0,0,0,0.15);" + "-fx-border-radius: 10;" + "-fx-text-fill: black;");
}
if (titleLabel != null)
{
titleLabel.setStyle("-fx-font-size: 26px;" + "-fx-font-weight: bold;" + "-fx-text-fill: #222222;");
}
if (nowPlayingLabel != null)
{
nowPlayingLabel.setStyle("-fx-padding: 12;" + "-fx-background-color: white;" + "-fx-background-radius: 10;" + "-fx-border-color: rgba(0,0,0,0.15);" + "-fx-border-radius: 10;" + "-fx-text-fill: black;");
}
} }
} }
+153 -39
View File
@@ -1,36 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.geometry.Pos?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.Separator?> <?import javafx.scene.control.Separator?>
<?import javafx.scene.image.Image?> <?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<VBox fx:id="rootPane" <VBox fx:id="rootPane"
xmlns:fx="http://javafx.com/fxml" xmlns:fx="http://javafx.com/fxml"
fx:controller="sbu.javafx.MusicController" fx:controller="sbu.javafx.MusicController"
spacing="20"
alignment="TOP_CENTER" alignment="TOP_CENTER"
prefWidth="500" spacing="18"
prefHeight="700" prefWidth="520"
style="-fx-padding: 30; -fx-background-color: #F4F4F4;"> prefHeight="720"
style="-fx-padding: 24; -fx-background-color: #F8F8F8;">
<Label fx:id="titleLabel" text="JavaFX Music Player" <padding>
style="-fx-font-size: 26px; -fx-font-weight: bold; -fx-text-fill: #333;" /> <Insets top="24" right="24" bottom="24" left="24"/>
</padding>
<Label fx:id="titleLabel"
text="JavaFX Music Player"
style="-fx-font-size: 26px; -fx-font-weight: bold; -fx-text-fill: #222222;" />
<Label fx:id="nowPlayingLabel" <Label fx:id="nowPlayingLabel"
text="Now Playing: None" text="Now Playing: None"
maxWidth="Infinity" maxWidth="Infinity"
alignment="CENTER" alignment="CENTER"
style="-fx-padding: 15; -fx-background-color: white; -fx-background-radius: 12; -fx-border-color: #DDD; -fx-border-radius: 12; -fx-font-size: 14px;" /> style="-fx-padding: 12; -fx-background-color: white; -fx-background-radius: 10; -fx-border-color: rgba(0,0,0,0.15); -fx-border-radius: 10; -fx-text-fill: black;" />
<HBox spacing="15" alignment="CENTER"> <HBox spacing="14" alignment="CENTER">
<Button fx:id="themeBtn" onAction="#handleToggleTheme" prefWidth="60" prefHeight="60" style="-fx-background-radius: 30;"> <Button fx:id="themeBtn"
onAction="#handleToggleTheme"
prefWidth="56"
prefHeight="56"
style="-fx-background-radius: 28;">
<graphic> <graphic>
<ImageView fitWidth="28" fitHeight="28" preserveRatio="true"> <ImageView fitWidth="26" fitHeight="26" preserveRatio="true">
<image> <image>
<Image url="@images/theme.png"/> <Image url="@images/theme.png"/>
</image> </image>
@@ -38,9 +48,13 @@
</graphic> </graphic>
</Button> </Button>
<Button fx:id="playlistBtn" onAction="#handleViewPlaylist" prefWidth="60" prefHeight="60" style="-fx-background-radius: 30;"> <Button fx:id="playlistBtn"
onAction="#handleViewPlaylist"
prefWidth="56"
prefHeight="56"
style="-fx-background-radius: 28;">
<graphic> <graphic>
<ImageView fitWidth="28" fitHeight="28" preserveRatio="true"> <ImageView fitWidth="26" fitHeight="26" preserveRatio="true">
<image> <image>
<Image url="@images/playlist.png"/> <Image url="@images/playlist.png"/>
</image> </image>
@@ -51,64 +65,164 @@
<Separator /> <Separator />
<VBox spacing="15" VBox.vgrow="ALWAYS"> <VBox spacing="12" VBox.vgrow="ALWAYS">
<HBox fx:id="songCard1" spacing="15" alignment="CENTER_LEFT" <!-- Song 1 -->
style="-fx-padding: 15; -fx-background-color: white; -fx-background-radius: 10; -fx-border-color: #EEE; -fx-border-radius: 10;"> <HBox alignment="CENTER_LEFT"
<VBox spacing="5" HBox.hgrow="ALWAYS"> spacing="14"
style="-fx-padding: 14; -fx-background-color: white; -fx-background-radius: 12; -fx-border-color: #EAEAEA; -fx-border-radius: 12;">
<VBox spacing="2" HBox.hgrow="ALWAYS">
<Label text="Careless Whisper" style="-fx-font-weight: bold; -fx-font-size: 16px;" /> <Label text="Careless Whisper" style="-fx-font-weight: bold; -fx-font-size: 16px;" />
<Label text="George Michael" style="-fx-text-fill: #777;" /> <Label text="George Michael • 5:02" style="-fx-text-fill: #777777; -fx-font-size: 12px;" />
</VBox> </VBox>
<Button onAction="#handlePlay1" prefWidth="45" prefHeight="45">
<Button fx:id="playBtn1"
onAction="#handlePlay1"
prefWidth="46"
prefHeight="46"
style="-fx-background-radius: 23;">
<graphic> <graphic>
<ImageView fitWidth="20" fitHeight="20"><image><Image url="@images/play.png"/></image></ImageView> <ImageView fx:id="playIcon1" fitWidth="20" fitHeight="20" preserveRatio="true">
<image>
<Image url="@images/play.png"/>
</image>
</ImageView>
</graphic> </graphic>
</Button> </Button>
<Button onAction="#handleAdd1" prefWidth="45" prefHeight="45">
<Button fx:id="stopBtn1"
onAction="#handleStop1"
prefWidth="46"
prefHeight="46"
style="-fx-background-radius: 23;">
<graphic> <graphic>
<ImageView fitWidth="20" fitHeight="20"><image><Image url="@images/add.png"/></image></ImageView> <ImageView fx:id="stopIcon1" fitWidth="20" fitHeight="20" preserveRatio="true">
<image>
<Image url="@images/stop.png"/>
</image>
</ImageView>
</graphic>
</Button>
<Button onAction="#handleAdd1"
prefWidth="46"
prefHeight="46"
style="-fx-background-radius: 23;">
<graphic>
<ImageView fitWidth="20" fitHeight="20" preserveRatio="true">
<image>
<Image url="@images/add.png"/>
</image>
</ImageView>
</graphic> </graphic>
</Button> </Button>
</HBox> </HBox>
<HBox fx:id="songCard2" spacing="15" alignment="CENTER_LEFT" <!-- Song 2 -->
style="-fx-padding: 15; -fx-background-color: white; -fx-background-radius: 10; -fx-border-color: #EEE; -fx-border-radius: 10;"> <HBox alignment="CENTER_LEFT"
<VBox spacing="5" HBox.hgrow="ALWAYS"> spacing="14"
style="-fx-padding: 14; -fx-background-color: white; -fx-background-radius: 12; -fx-border-color: #EAEAEA; -fx-border-radius: 12;">
<VBox spacing="2" HBox.hgrow="ALWAYS">
<Label text="Adore You" style="-fx-font-weight: bold; -fx-font-size: 16px;" /> <Label text="Adore You" style="-fx-font-weight: bold; -fx-font-size: 16px;" />
<Label text="Harry Styles" style="-fx-text-fill: #777;" /> <Label text="Harry Styles • 3:27" style="-fx-text-fill: #777777; -fx-font-size: 12px;" />
</VBox> </VBox>
<Button onAction="#handlePlay2" prefWidth="45" prefHeight="45">
<Button fx:id="playBtn2"
onAction="#handlePlay2"
prefWidth="46"
prefHeight="46"
style="-fx-background-radius: 23;">
<graphic> <graphic>
<ImageView fitWidth="20" fitHeight="20"><image><Image url="@images/play.png"/></image></ImageView> <ImageView fx:id="playIcon2" fitWidth="20" fitHeight="20" preserveRatio="true">
<image>
<Image url="@images/play.png"/>
</image>
</ImageView>
</graphic> </graphic>
</Button> </Button>
<Button onAction="#handleAdd2" prefWidth="45" prefHeight="45">
<Button fx:id="stopBtn2"
onAction="#handleStop2"
prefWidth="46"
prefHeight="46"
style="-fx-background-radius: 23;">
<graphic> <graphic>
<ImageView fitWidth="20" fitHeight="20"><image><Image url="@images/add.png"/></image></ImageView> <ImageView fx:id="stopIcon2" fitWidth="20" fitHeight="20" preserveRatio="true">
<image>
<Image url="@images/stop.png"/>
</image>
</ImageView>
</graphic>
</Button>
<Button onAction="#handleAdd2"
prefWidth="46"
prefHeight="46"
style="-fx-background-radius: 23;">
<graphic>
<ImageView fitWidth="20" fitHeight="20" preserveRatio="true">
<image>
<Image url="@images/add.png"/>
</image>
</ImageView>
</graphic> </graphic>
</Button> </Button>
</HBox> </HBox>
<HBox fx:id="songCard3" spacing="15" alignment="CENTER_LEFT" <!-- Song 3 -->
style="-fx-padding: 15; -fx-background-color: white; -fx-background-radius: 10; -fx-border-color: #EEE; -fx-border-radius: 10;"> <HBox alignment="CENTER_LEFT"
<VBox spacing="5" HBox.hgrow="ALWAYS"> spacing="14"
style="-fx-padding: 14; -fx-background-color: white; -fx-background-radius: 12; -fx-border-color: #EAEAEA; -fx-border-radius: 12;">
<VBox spacing="2" HBox.hgrow="ALWAYS">
<Label text="Wildflower" style="-fx-font-weight: bold; -fx-font-size: 16px;" /> <Label text="Wildflower" style="-fx-font-weight: bold; -fx-font-size: 16px;" />
<Label text="Billie Eilish" style="-fx-text-fill: #777;" /> <Label text="Billie Eilish • 4:15" style="-fx-text-fill: #777777; -fx-font-size: 12px;" />
</VBox> </VBox>
<Button onAction="#handlePlay3" prefWidth="45" prefHeight="45">
<Button fx:id="playBtn3"
onAction="#handlePlay3"
prefWidth="46"
prefHeight="46"
style="-fx-background-radius: 23;">
<graphic> <graphic>
<ImageView fitWidth="20" fitHeight="20"><image><Image url="@images/play.png"/></image></ImageView> <ImageView fx:id="playIcon3" fitWidth="20" fitHeight="20" preserveRatio="true">
<image>
<Image url="@images/play.png"/>
</image>
</ImageView>
</graphic> </graphic>
</Button> </Button>
<Button onAction="#handleAdd3" prefWidth="45" prefHeight="45">
<Button fx:id="stopBtn3"
onAction="#handleStop3"
prefWidth="46"
prefHeight="46"
style="-fx-background-radius: 23;">
<graphic> <graphic>
<ImageView fitWidth="20" fitHeight="20"><image><Image url="@images/add.png"/></image></ImageView> <ImageView fx:id="stopIcon3" fitWidth="20" fitHeight="20" preserveRatio="true">
<image>
<Image url="@images/stop.png"/>
</image>
</ImageView>
</graphic>
</Button>
<Button onAction="#handleAdd3"
prefWidth="46"
prefHeight="46"
style="-fx-background-radius: 23;">
<graphic>
<ImageView fitWidth="20" fitHeight="20" preserveRatio="true">
<image>
<Image url="@images/add.png"/>
</image>
</ImageView>
</graphic> </graphic>
</Button> </Button>
</HBox> </HBox>
</VBox> </VBox>
<Label text="SBU JavaFX Project - 2024" style="-fx-text-fill: #AAA; -fx-font-size: 10px;" /> <Label text="SBU JavaFX Project - 2026"
style="-fx-text-fill: #AAAAAA; -fx-font-size: 10px;" />
</VBox> </VBox>
+6 -3
View File
@@ -1,12 +1,15 @@
.root { .root
{
-fx-background-color: #1e1e1e; -fx-background-color: #1e1e1e;
} }
.label { .label
{
-fx-text-fill: white; -fx-text-fill: white;
} }
.button { .button
{
-fx-background-color: #444; -fx-background-color: #444;
-fx-text-fill: white; -fx-text-fill: white;
} }
+6 -3
View File
@@ -1,12 +1,15 @@
.root { .root
{
-fx-background-color: white; -fx-background-color: white;
} }
.label { .label
{
-fx-text-fill: black; -fx-text-fill: black;
} }
.button { .button
{
-fx-background-color: #e0e0e0; -fx-background-color: #e0e0e0;
-fx-text-fill: black; -fx-text-fill: black;
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB