nazim_tafat
Messages postés12Date d'inscriptionvendredi 19 août 2005StatutMembreDernière intervention 4 juin 2008
-
28 mars 2006 à 15:50
cs_nomad56
Messages postés54Date d'inscriptionsamedi 16 avril 2005StatutMembreDernière intervention13 avril 2006
-
1 avril 2006 à 03:50
j'ai un problemme que j'arrive pas a le regler si quelqu'un peux m'aider .je veux ajoutter
JButton dans player.(cad ajoutter ca JButton jButton4 new JButton(ImageIcon icone4 new ImageIcon("C:/image/retour.jpg")) dans player.getVisualComponent()) et merci pour la reponse.voici mon mail pour me repondre [mailto:nazim_tafat@yahoo.fr nazim_tafat@yahoo.fr]
* @author non attribuable
* @version 1.0
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.JFrame.*;
public class PlayerVideo extends JFrame implements ControllerListener{
//public class PlayerVideo extends JFrame {
private JPanel jPanel1 = null;
JPanel jPanel2 = new JPanel();
JButton jButton1 = new JButton();
JLabel jLabel1 = new JLabel();
JButton jButton2 = new JButton();
JLabel jLabel2 = new JLabel();
JButton jButton3 = new JButton();
JPanel jPanel3 ;
//private JButton Playe=null;
//private JSlider jSlider1=null;
private Player player=null;
// private volatile boolean follows_slider = false;
//float step = 1.0f / 10;
public PlayerVideo(String nomFilm) {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
setLocation(60,40);
addWindowListener( new WindowAdapter()
{
public void windowClosing( WindowEvent we )
{
JOptionPane.showMessageDialog(null, "Thank you to have used Video Player", "Quit",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
);
if ( nomFilm != null)
loadMovie( nomFilm ); // load the movie
}
/******************************************
* method of loading of film from its URL *
******************************************/
private void loadMovie( String movieURL )
{
if ( movieURL.indexOf( ":" ) < 3 ) movieURL = "file:" + movieURL;
try
{ // creation of the player
player = Manager.createPlayer( new MediaLocator( movieURL ) );
player.addControllerListener( this ) ;
player.realize();
}
catch (Exception e)
{
System.out.println("Error creating player");
return;
}
}
public void controllerUpdate(ControllerEvent parm1) {
if ( parm1 instanceof RealizeCompleteEvent )
{
if ( jPanel1 == null)
{ //creation of the panel of sight
jPanel1 = new JPanel();
jPanel1.setLayout(new BorderLayout() );
getContentPane().add( jPanel1, BorderLayout.NORTH);
}
else
jPanel1.removeAll();
//obtaining the component restoring the image in provenence of the player.
Component vis = player.getVisualComponent();
if ( vis != null )
{ // if it is valid then we put it in our sight
jPanel1.add( vis, BorderLayout.CENTER);
jPanel1.setVisible(true);
this.pack(); // resize the size according to the size of film
}
Component controlsComponent =player.getControlPanelComponent();
if ( controlsComponent != null )
{
jPanel1.add(controlsComponent,BorderLayout.SOUTH);
}
jPanel1.doLayout();
}
else if ( parm1 instanceof EndOfMediaEvent )
{
if (player != null)
{ //stop the movie
player.stop();
player.deallocate();
}
}
}
void Stop_actionPerformed(ActionEvent e) {
player.stop();
player.deallocate();
System.out.println("Stop");
player.setMediaTime(new Time(0)); //puts the video at the beginning
if (player.getTargetState() < Player.Started)
player.prefetch();
}
}
class PlayerVideo_Pause_actionAdapter implements java.awt.event.ActionListener {
PlayerVideo adaptee;