Question: I need help with the code in java fx please, no swing or awt. I provided the code that needs to be added to along

I need help with the code in java fx please, no swing or awt. I provided the code that needs to be added to along with a picture of the expected output.
Ex01, Enhanced the Video Player application
1. Add two new buttons (Open and Mute) to enhance the existing application (refer to the code on page 978).
a. The Open button will allow the user to use a File-Chooser dialog window to select a different video file.
i. If the user indeed selects a video file, make sure to reset the following:
1. Stop playing the video file if it is playing.
2. Make sure to set the text of the Mute button to Mute.
3. Load the new video file image into your app and set the mediaview controls size back to
640x480.
b. The Mute button will allow the user to mute or unmute the sound.
i. After the Mute button is clicked, make sure to change the text on the button to UnMute and mute
the sound.
ii. After the UnMute button is clicked, make sure to change the text on the button to Mute and
unmute the sound.
c. When the Stop button is clicked, you just need to stop playing the video. There is no need to change the state
of the mute or unmute situation or text.
2. You are required to create an app similar to the app in the screenshot.
3. I will use the HD screen resolution (1920x1080)
public class VideoPlayer extends Application {
public static void main(String[]args)
{
launch(args);
}
@Override
public void start(Stage primaryStage)
{
final double WIDTH =640.0, HEIGHT =480.0;
File videoFile = new File("TakeOff.mp4");
Media media = new Media(videoFile.toURI().toString());
MediaPlayer player = new MediaPlayer(media);
player.setOnEndOfMedia(()->
{
player.stop();
});
MediaView view = new MediaView(player);
view.setFitWidth(WIDTH);
view.setFitHeight(HEIGHT);
Button playButton = new Button("Play");
Button pauseButton = new Button("Pause");
Button stopButton = new Button("Stop");
playButton.setOnAction(event ->
{
player.play();
});
pauseButton.setOnAction(event ->
{
player.pause();
});
stopButton.setOnAction(event ->
{
player.stop();
});
HBox hbox = new HBox(10, playButton, pauseButton, stopButton);
hbox.setAlignment(Pos.CENTER);
hbox.setPadding(new Insets(10));
BorderPane borderPane = new BorderPane();
borderPane.setCenter(view);
borderPane.setBottom(hbox);
Scene scene = new Scene(borderPane);
primaryStage.setScene(scene);
primaryStage.show();
}
}
I need help with the code in java fx please, no

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!