Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

50
LINES

< > BotCompany Repo | #1003703 // Try Putting JavaFX Video in Swing JFrame

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1453L/10K/34K).

1  
!752
2  
3  
import javafx.application.Platform;
4  
import javafx.embed.swing.JFXPanel;
5  
import javafx.scene.Group;
6  
import javafx.scene.Scene;
7  
import javafx.scene.paint.Color;
8  
import javafx.scene.text.Font;
9  
import javafx.scene.text.Text;
10  
import javafx.scene.media.Media;
11  
import javafx.scene.media.MediaPlayer;
12  
import javafx.scene.media.MediaView;
13  
14  
p-awt {
15  
  jfxFastVideo();
16  
  
17  
  JFrame frame = showFrame();
18  
  final new JFXPanel fxPanel;
19  
  frame.add(fxPanel);
20  
21  
  jfxLater(r {
22  
    fxPanel.setScene(createScene());
23  
  });
24  
}
25  
26  
// JavaFX World
27  
static Scene createScene() {
28  
  new Group root;
29  
  Scene scene = new Scene(root, Color.ALICEBLUE);
30  
31  
  // Create the media source.
32  
  //String source = getParameters().getRaw().get(0);
33  
  String source = "/media/CE009E97009E865D__/Downloads/Oblivion (2013)/Oblivion.2013.mp4";
34  
  Media media = null;
35  
  try {
36  
    media = new Media(new File(source).toURI().toURL().toString());
37  
  } catch (MalformedURLException e) {
38  
    throw new RuntimeException(e);
39  
  }
40  
41  
  // Create the player and set to play automatically.
42  
  MediaPlayer mediaPlayer = new MediaPlayer(media);
43  
  mediaPlayer.setAutoPlay(true);
44  
45  
  // Create the view and add it to the Scene.
46  
  MediaView mediaView = new MediaView(mediaPlayer);
47  
  
48  
  root.getChildren().add(mediaView);
49  
  ret scene;
50  
}

Author comment

Began life as a copy of #1003701

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

Comments [hide]

ID Author/Program Comment Date
1260 stefan jfxFastVideo() makes this SLOWER... uargh 2016-07-26 00:26:06
1258 stefan Works, just still doesn't resize content 2016-07-26 00:10:21

add comment

Snippet ID: #1003703
Snippet name: Try Putting JavaFX Video in Swing JFrame
Eternal ID of this version: #1003703/1
Text MD5: f45620525e4c3454e40ed309c87b4dd0
Transpilation MD5: a4a5d0cdc2f7b647ac657dc527f84fd5
Author: stefan
Category: javax / javafx
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-07-26 00:25:06
Source code size: 1317 bytes / 50 lines
Pitched / IR pitched: No / No
Views / Downloads: 665 / 709
Referenced in: [show references]