Problem with drawing Swingcomponents over the Videocomponent
Hi there,
I'm trying to draw a simple Swingcomponent over a running video - I read in the Forums for days - nothing helped. I don't know why it still don't work.
LIGHTWEIGHT_RENDERER is already used
JLayeredPane is already used
Please help me - I don't what I can do anyway
publicclass MySecondJMFAppextends JFrameimplements ControllerListener{
private Player player;
public MySecondJMFApp(){
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
try{
Manager.setHint(Manager.LIGHTWEIGHT_RENDERER,new Boolean(true));
player = Manager.createPlayer(new MediaLocator("file:C://video.mpg"));
player.addControllerListener(this);
player.realize();
}catch (Exception e){
e.printStackTrace();
}
}
publicsynchronizedvoid controllerUpdate(ControllerEvent e){
if(einstanceof RealizeCompleteEvent){
this.setBounds(0, 0, 800, 600);
this.setLocation(0,0);
JLayeredPane layeredPane =new JLayeredPane();
layeredPane.setPreferredSize(this.getSize());
layeredPane.setLocation(0,0);
this.add(layeredPane);
Component video = player.getVisualComponent();
video.setLocation(0, 0);
video.setSize(this.getSize());
JLabel label =new JLabel("THIS IS A RED TEXT");
label.setForeground(Color.red);
label.setOpaque(false);
label.setLocation(0, 0);
label.setSize(this.getSize());
//also tryedlabel.setSize(this.getSize().width + 1, this.getSize().height + 1);
layeredPane.add(video,new Integer(1));
layeredPane.add(label,new Integer(10));
player.start();
this.setVisible(true);
}
}
publicstaticvoid main(String args[]){
MyFirstJMFApp jmf =new MyFirstJMFApp();
}
}

