我已经安装了 Ubuntu 14.04,当我实例化 MediaPlayer 时出现错误。
package mediatest;
import java.io.File;
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.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.stage.Stage;
/**
*
* @author DESARROLLO
*/
public class MediaTest extends Application {
@Override
public void start(Stage primaryStage) {
Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
Media media = new Media(new File("rotate.mp4").toURI().toASCIIString());
MediaPlayer player = new MediaPlayer(media);
}
});
StackPane root = new StackPane(); …Run Code Online (Sandbox Code Playgroud)