package sbu.javafx;

import de.codecentric.centerdevice.javafxsvg.SvgImageLoaderFactory;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import javafx.scene.image.Image;

public class MusicApp extends Application {

    @Override
    public void start(Stage stage) throws IOException
    {
//        SvgImageLoaderFactory.install();
//        InputStream iconStream = getClass().getResourceAsStream("icon.svg");
//        if (iconStream != null)
//        {
//            Image icon = new Image(iconStream);
//            stage.getIcons().add(icon);
//            System.out.println("yesss");
//        } else
//        {
//            System.out.println("not found");
//        }
        FXMLLoader fxmlLoader = new FXMLLoader(MusicApp.class.getResource("App-view.fxml"));
        Scene scene = new Scene(fxmlLoader.load());
        stage.setTitle("Music Player");
        stage.setScene(scene);

        //TODO: add icon to the stage
//        InputStream iconStream = new FileInputStream("musicIcon.png");
//        if (iconStream != null)
//        {
//            stage.getIcons().add(new Image(iconStream));
//        } else {
//            System.out.println("not found");
//        }
        stage.show();
    }

}
