I've been having difficulties calling a Java file that I've created from another Java file that would contain the UI elements. Here is the Java code that I'm trying to call:
public class XzibitVideo extends Application{
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
String path = "Data/Video/Clip.flv";
Media media = new Media(new File(path).toURI().toString());
MediaPlayer mediaPlayer = new MediaPlayer(media);
MediaView mediaView = new MediaView(mediaPlayer);
BorderPane borderPane = new BorderPane();
borderPane.setCenter(mediaView);
//borderPane.setStyle("-fx-background-color: Black");
//borderPane.setBottom(addToolBar());
Scene scene = new Scene(borderPane, 1024, 800);
scene.setFill(javafx.scene.paint.Color.BLACK);
stage.setTitle("Media Player");
stage.setScene(scene);
stage.show();
mediaPlayer.setAutoPlay(true);
mediaPlayer.setOnError(()->System.out.println("media error"+ mediaPlayer.getError().toString()));
}
}
I've tried a couple of methods to call it, but im afraid none of them worked. for example,
XzibitVideo programVideo = new XzibitVideo();
programVideo.start();
XzibitVideo programVideo = new XzibitVideo();
programVideo.run();
XzibitVideo programVideo = new XzibitVideo();
programVideo.main();
*I've also tried adding arguements/parameters, but with no luck:
XzibitVideo programVideo = new XzibitVideo();
programVideo.start(Stage stage);
If anyone has any idea on how to properly call this function i would be extremely grateful! I've been working on this part for way too long, I'm losing all hope.. :(