Question

In: Computer Science

JAVAFX Create a JavaFx application that is an MP3 player. The size of the media player...

JAVAFX

Create a JavaFx application that is an MP3 player. The size of the media player should be 800 pixels in width and 650 pixels in height. The media player should have a TextField that allows the user to type the full path of the .mp3 file to be played. The application should also use 2 Checkbox controls to show/hide the total playing time and the status (methods of MediaPlayer class). Use 2 RadioButton controls to change background colors (red or blue). The media player should implement the following functional controls

play
stop
volume up
volume down

Solutions

Expert Solution

I this code will help you

this is a simple media player

code:

==================================

package javafxapplication2;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import java.io.File;
  
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
import javafx.stage.Stage;


public class JavaFXApplication2 extends Application {
  
@Override
public void start(Stage primaryStage)throws Exception {
  
String path = "";
Label user_id=new Label("MP3 Path ");
  
TextField tf1=new TextField();
  
Button b = new Button("Play");
b.setOnAction(e->path=tf1.getText());
  
GridPane root = new GridPane();
root.addRow(0, user_id, tf1);
  
root.addRow(2, b);
  
  

  
//Instantiating Media class
Media media = new Media(new File(path).toURI().toString());
  
//Instantiating MediaPlayer class   
MediaPlayer mediaPlayer = new MediaPlayer(media);
  
//by setting this property to true, the audio will be played   
mediaPlayer.setAutoPlay(true);
primaryStage.setTitle("Playing Audio");
primaryStage.show();
  
  
  
  
Scene scene = new Scene(root, 800, 650);
  
primaryStage.setTitle("Media Player");
primaryStage.setScene(scene);
primaryStage.show();
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
  
}


Related Solutions

Java Please comment code Create an Interactive JavaFX Application Create an application with the following controls:...
Java Please comment code Create an Interactive JavaFX Application Create an application with the following controls: A Label control with the following text displayed: "First Number:" A Label control with the following text displayed: "Second Number:" An empty TextField control beside the First Number label. An empty TextField control beside the Second Number label. Five buttons: Button 1 labeled + Button 2 labeled - Button 3 labeled * Button 4 labeled / Button 5 labeled = An empty Label control...
Create a JavaFX application that lets the user enter the food charge for a meal at...
Create a JavaFX application that lets the user enter the food charge for a meal at a restaurant. For example, if $20 is entered as a food charge for a meal then $3.6 should be displayed for the tip, $1.4 should be displayed for sales tax, and $25 should be displayed as a total of all three amounts. Modification 1: create a text box (not a pop up) for the user to enter a percent tip (don't just hardcode it...
Write a JavaFX application that draws a circle using a rubberbanding technique. The circle size is...
Write a JavaFX application that draws a circle using a rubberbanding technique. The circle size is determined by a mouse drag. Use the initial mouse press location as the fixed center point of the circle. Compute the distance between the current location of the mouse pointer and the center point to determine the current radius of the circle.
Create in C Sharp : Create an application that predicts the approximate size of a population...
Create in C Sharp : Create an application that predicts the approximate size of a population of organisms. The application should use text boxes to allow the user to enter the starting number of organisms, the average daily population increase (as a percentage), and the number of days the organisms will be left to multiply. For example, assume the user enters the following values in text boxes: Starting number of organisms: 2 Average daily increase: 30% Number of days to...
Create a C# application for Cricket Team that allows you to enter data for player of...
Create a C# application for Cricket Team that allows you to enter data for player of Cricket Team and saves the data to a file named Players.txt. Create a Player class that contains fields for of participant's first name, last name, age, salary and position (wicketkeeper, bawler, striker, midwicket), and To String() method. The fields of records in the file are separated with semicolon (. Expecting sentinel value for ending the process of writing to file is *. E.g. of...
This lab is designed to design an event driven animation application which JavaFX application implementing a...
This lab is designed to design an event driven animation application which JavaFX application implementing a racing car image. The car moves from left to right. When it hits the right end, it restarts from the left and continues the same process. Let the user pause/resume the animation with a button press/release and increase/decrease the car speed by pressing the up and down arrow keys. The car used for this application has the following attributes. Task(s) Task 1: Create a...
The manufacturer of an MP3 player wanted to know whether a 10% reduction in price is...
The manufacturer of an MP3 player wanted to know whether a 10% reduction in price is enough to increase the sales of its product. To investigate, the owner randomly selected eight outlets and sold the MP3 player at the reduced price. At seven randomly selected outlets, the MP3 player was sold at the regular price. Reported below is the number of units sold last month at the regular and reduced prices at the randomly selected outlets. Regular price 138 121...
The manufacturer of an MP3 player wanted to know whether a 10% reduction in price is...
The manufacturer of an MP3 player wanted to know whether a 10% reduction in price is enough to increase the sales of its product. To investigate, the owner randomly selected eight outlets and sold the MP3 player at the reduced price. At seven randomly selected outlets, the MP3 player was sold at the regular price. Reported below is the number of units sold last month at the regular and reduced prices at the randomly selected outlets. Regular price 135 121...
The manufacturer of an MP3 player wanted to know whether a 10% reduction in price is...
The manufacturer of an MP3 player wanted to know whether a 10% reduction in price is enough to increase the sales of its product. To investigate, the owner randomly selected eight outlets and sold the MP3 player at the reduced price. At seven randomly selected outlets, the MP3 player was sold at the regular price. Reported below is the number of units sold last month at the regular and reduced prices at the randomly selected outlets. Regular price 136 128...
The manufacturer of an MP3 player wanted to know whether a 10% reduction in price is...
The manufacturer of an MP3 player wanted to know whether a 10% reduction in price is enough to increase the sales of its product. To investigate, the owner randomly selected eight outlets and sold the MP3 player at the reduced price. At seven randomly selected outlets, the MP3 player was sold at the regular price. Reported below is the number of units sold last month at the regular and reduced prices at the randomly selected outlets. Regular price 138 121...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT