forked from AdvancedProgramming1404/HW-07-JavaFX
completed
This commit is contained in:
@@ -30,6 +30,7 @@ public class Main extends Application {
|
|||||||
);
|
);
|
||||||
|
|
||||||
controller.setupListView(controller.musicsListView);
|
controller.setupListView(controller.musicsListView);
|
||||||
|
controller.setupListView(controller.playlistListView);
|
||||||
|
|
||||||
Scene scene = new Scene(root, 500, 600);
|
Scene scene = new Scene(root, 500, 600);
|
||||||
scene.getStylesheets().add(
|
scene.getStylesheets().add(
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public class MusicController {
|
|||||||
private boolean isDarkMode=true;
|
private boolean isDarkMode=true;
|
||||||
private boolean isPlaying=false;
|
private boolean isPlaying=false;
|
||||||
private boolean isMute=false;
|
private boolean isMute=false;
|
||||||
|
private boolean isOpen=false;
|
||||||
private Song currentSong = null;
|
private Song currentSong = null;
|
||||||
ImageView playIcon;
|
ImageView playIcon;
|
||||||
ImageView pauseIcon;
|
ImageView pauseIcon;
|
||||||
@@ -134,10 +135,7 @@ public class MusicController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void changeTheme(){
|
public void changeTheme(){
|
||||||
|
|
||||||
|
|
||||||
Scene scene = root.getScene();
|
Scene scene = root.getScene();
|
||||||
|
|
||||||
scene.getStylesheets().clear();
|
scene.getStylesheets().clear();
|
||||||
|
|
||||||
if(isDarkMode){
|
if(isDarkMode){
|
||||||
@@ -213,20 +211,53 @@ public class MusicController {
|
|||||||
|
|
||||||
// TODO:This method should open a new window or change the current scene to display the "Playlist" page.
|
// TODO:This method should open a new window or change the current scene to display the "Playlist" page.
|
||||||
|
|
||||||
public void openPlaylistWindow() {
|
public void openPlaylistWindow(ActionEvent e) {
|
||||||
//Create a new stage and show the playlist UI.
|
|
||||||
musicsListView.setVisible(false);
|
if(isPlaying)
|
||||||
if(playlistListView!=null)
|
playPause(e);
|
||||||
playlistListView.setVisible(true);
|
|
||||||
|
if(!isOpen){
|
||||||
|
|
||||||
|
// باز کردن پلیلیست
|
||||||
|
|
||||||
|
if(playlistListView.getItems().isEmpty()){
|
||||||
|
|
||||||
else{
|
|
||||||
Alert alert = new Alert(Alert.AlertType.WARNING);
|
Alert alert = new Alert(Alert.AlertType.WARNING);
|
||||||
|
|
||||||
alert.setTitle("Empty Playlist");
|
alert.setTitle("Empty Playlist");
|
||||||
alert.setHeaderText(null);
|
alert.setHeaderText(null);
|
||||||
alert.setContentText("Playlist is empty!");
|
alert.setContentText("Playlist is empty!");
|
||||||
|
|
||||||
alert.showAndWait();
|
alert.showAndWait();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isOpen = true;
|
||||||
|
|
||||||
|
openPlaylistBtn.setText("Back");
|
||||||
|
|
||||||
|
musicsListView.setVisible(false);
|
||||||
|
musicsListView.setManaged(false);
|
||||||
|
|
||||||
|
playlistListView.setVisible(true);
|
||||||
|
playlistListView.setManaged(true);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// برگشت به صفحه اصلی
|
||||||
|
|
||||||
|
isOpen = false;
|
||||||
|
|
||||||
|
openPlaylistBtn.setText("Open Playlist");
|
||||||
|
|
||||||
|
musicsListView.setVisible(true);
|
||||||
|
musicsListView.setManaged(true);
|
||||||
|
|
||||||
|
playlistListView.setVisible(false);
|
||||||
|
playlistListView.setManaged(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -26,8 +26,10 @@
|
|||||||
<ListView fx:id="musicsListView" VBox.vgrow="ALWAYS"/>
|
<ListView fx:id="musicsListView" VBox.vgrow="ALWAYS"/>
|
||||||
|
|
||||||
<!-- آهنگ های پلی لیست-->
|
<!-- آهنگ های پلی لیست-->
|
||||||
<ListView fx:id="playlistListView" visible="false"
|
<ListView fx:id="playlistListView"
|
||||||
managed="false" VBox.vgrow="ALWAYS"/>
|
visible="false"
|
||||||
|
managed="false"
|
||||||
|
VBox.vgrow="ALWAYS"/>
|
||||||
|
|
||||||
<!-- باکس آهنگ در حال پخش -->
|
<!-- باکس آهنگ در حال پخش -->
|
||||||
<VBox alignment="CENTER" spacing="5">
|
<VBox alignment="CENTER" spacing="5">
|
||||||
@@ -93,7 +95,8 @@
|
|||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button fx:id="openPlaylistBtn"
|
<Button fx:id="openPlaylistBtn"
|
||||||
text="Playlist"
|
onAction="#openPlaylistWindow"
|
||||||
|
text="Open Playlist"
|
||||||
style="-fx-background-radius: 15px;" />
|
style="-fx-background-radius: 15px;" />
|
||||||
|
|
||||||
</HBox>
|
</HBox>
|
||||||
|
|||||||
Reference in New Issue
Block a user