Adding Component over Video(Visual component)

Hi All

I'm new to JMF.My goal is to add a Swing component on top of video.In this test exaple i'm trying to add a Button on top of video.When i run the test i can c only video playing and no trace of button in the foreground.Can anyone help me with this.Here's the code

publicclass JMFSample

{

// launch the application

publicstaticvoid main( String args[] )

{

URL mediaURL =null;

try

{

mediaURL =new URL("demo.mpg");

}// end try

catch ( MalformedURLException malformedURLException )

{

System.err.println("Could not create URL for the file" );

}// end catch

try

{

Manager.setHint( Manager.LIGHTWEIGHT_RENDERER,true );

Player mediaPlayer = nager.createRealizedPlayer(mediaURL);

// add components

Component visualComp = MediaPlayer.getVisualComponent();

JFrame myframe =new JFrame();

LayeredPane layers =new JLayeredPane(){

public Dimension getPreferredSize(){

returnnew Dimension (300,300);

}

public Dimension getMinimumSize(){

returnnew Dimension (300,300);

}

};

visualComp.setBounds (0, 0,

visualComp.getPreferredSize().width,

visualComp.getPreferredSize().height);

layers.add (visualComp, JLayeredPane.DEFAULT_LAYER);

Button myOverlay =new Button("overlayText");

layers.add(myOverlay, JLayeredPane.POPUP_LAYER);

myframe.add(layers);

myframe.pack();

myframe.setVisible(true);

}

catch ( NoPlayerException noPlayerException )

{

System.err.println("No media player found" );

}// end catch

catch ( CannotRealizeException cannotRealizeException )

{

System.err.println("Could not realize media player" );

}// end catch

catch ( IOException iOException )

{

System.err.println("Error reading from the source" );

}

}// end main

}// end class MediaTes

[3791 byte] By [Pallavi_Na] at [2007-11-26 13:57:39]
# 1
I am also facing the same problem ...Can anybody help us out?
sndpmka at 2007-7-8 1:37:40 > top of Java-index,Security,Cryptography...