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();

}

}

[3161 byte] By [BlackCrazea] at [2007-11-27 7:35:06]
# 1

Hi there,

I solved the problem by myself :-)

I read the API-Documentation again and again until I recognized the little "try" in "JMF trys to create a lightweigt Component". So I tried some other videos and realized - this Code is definitly working if JMF is able to create a lightweigth Component. In some cases I saw the red text - in other cases not.

Good luck, if you have the same problem like I got ;-)

BlackCrazea at 2007-7-12 19:15:37 > top of Java-index,Security,Cryptography...