Z
Zarathustra
Hi, I would like to draw over a a video that I display with jmf...
This is my code, but don't work, I see the panel "above" my video.I
read several posts in the jmf forum, but I don't find any solution.Can
you help me?
I would draw in the drawpanel...
private void buildUI() {
this.rootPane.setDoubleBuffered(true);
this.layeredPane=new JLayeredPane();
Component videopanel = null;
this.layeredPane.add(videopanel, 0);
this.layeredPane.add(drawpanel, 10);
JFileChooser fileChooser = new JFileChooser("E:/");
int status = fileChooser.showOpenDialog(this);
if (status == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
try {
URL url = file.toURL();
final Container contentPane = getContentPane();
Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, new Boolean(true));
Manager.setHint(Manager.PLUGIN_PLAYER, new Boolean(true));
this.player = Manager.createRealizedPlayer(url);
videopanel = this.player.getVisualComponent();
if (videopanel != null){
contentPane.add(videopanel, BorderLayout.CENTER);
}
this.addMouseListener(this);
Component controlPanelComponent = this.player
.getControlPanelComponent();
Dimension d=videopanel.getMaximumSize();
if (controlPanelComponent != null)
contentPane.add(controlPanelComponent, BorderLayout.SOUTH);
pack();
this.player.start();
} catch (Exception e) {
System.out.println(e);
System.exit(-1);
}
}
}
This is my code, but don't work, I see the panel "above" my video.I
read several posts in the jmf forum, but I don't find any solution.Can
you help me?
I would draw in the drawpanel...
private void buildUI() {
this.rootPane.setDoubleBuffered(true);
this.layeredPane=new JLayeredPane();
Component videopanel = null;
this.layeredPane.add(videopanel, 0);
this.layeredPane.add(drawpanel, 10);
JFileChooser fileChooser = new JFileChooser("E:/");
int status = fileChooser.showOpenDialog(this);
if (status == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
try {
URL url = file.toURL();
final Container contentPane = getContentPane();
Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, new Boolean(true));
Manager.setHint(Manager.PLUGIN_PLAYER, new Boolean(true));
this.player = Manager.createRealizedPlayer(url);
videopanel = this.player.getVisualComponent();
if (videopanel != null){
contentPane.add(videopanel, BorderLayout.CENTER);
}
this.addMouseListener(this);
Component controlPanelComponent = this.player
.getControlPanelComponent();
Dimension d=videopanel.getMaximumSize();
if (controlPanelComponent != null)
contentPane.add(controlPanelComponent, BorderLayout.SOUTH);
pack();
this.player.start();
} catch (Exception e) {
System.out.println(e);
System.exit(-1);
}
}
}