0

I cant seem to get a new file loaded into my media player. Any idea why? I have tried using the Jfilechooser for swing but it wasn't compatible and I cant get the FX version to work. I am able to get the file open bar to show up. I can even see the open button, but when selected- nothing happens.

Is there something wrong with my scenes?

package jjcg;

import java.io.File;
import java.net.MalformedURLException;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.paint.Color;
import javafx.stage.FileChooser;
import javafx.stage.Stage;

/**
 *
 * @author Jarai
 */
public class JJCG extends Application {

    Player player;
    FileChooser filechooser;
    @Override
    public void start(final Stage primaryStage) {

        MenuItem open = new MenuItem("Open");
        Menu file = new Menu("File");
        MenuBar menu = new MenuBar();

        file.getItems().add(open);
        menu.getMenus().add(file);

        filechooser = new FileChooser();

        open.setOnAction((ActionEvent e) -> {
            player.player.pause();
            File file1;
            file1 = filechooser.showOpenDialog(primaryStage);
            if (file1 != null) {
                try {
                    player = new Player(file1.toURI().toURL().toExternalForm());
                    Scene scene = new Scene(player, 1400,750, Color.BLACK);
                    primaryStage.setScene(scene);
                }catch (MalformedURLException e1) {
                }
            }
        });

        Player player2;
        player2 = new Player("file:///C:/Users/Jarai/Videos/BL.mp4");
        player2.setTop(menu);
        Scene scene = new Scene(player2, 1400, 750, Color.BLACK);
        primaryStage.setScene(scene);
        primaryStage.show();

    }
    public static void main(String[] args) {
        launch(args);
    }

}
  • What platform are you running on? If I understand you correctly, you are saying that the `FileChooser` isn't displaying correctly when you select the "Open" menu item. Can you create a screenshot of the `FileChooser` and post a link to it in the question? Can you also either include your `Player` class, or make the code executable some other way? – James_D Jul 17 '15 at 14:24
  • http://1drv.ms/1J4TShR this has all of my code in it – Jarai Upward Jul 17 '15 at 15:18

0 Answers0