java chat using java media

java chat using java media

Remove the error of this code plz reply me fast on my mail ID **Deleted by Admin**

package chating;

//import java.applet.Applet; import java.awt.event.*; import java.awt.*; import javax.media.*; import javax.swing.*;

public class Player extends JFrame implements ActionListener, ControllerListener {

JButton fileButton;
JFileChooser file = new JFileChooser();
JLabel urlLabel;
JTextField urlField;
String mediaFile= "";
String FileName = "";
    private MediaLocator media;
    private javax.media.Player player = null;
    private boolean realized = false;
  JPanel topPanel, bottomPanel;
  Container p = getContentPane();
  Component display = null;



public Player() {

    super("Media Player v1.0");
    setSize(200,150);
    //GridLayout myGridLayout = new GridLayout(1,3);
    topPanel = new JPanel();
    topPanel.setLayout(new FlowLayout());
    urlLabel = new JLabel ("File:");
    topPanel.add (urlLabel);
    urlField = new JTextField (15);
    topPanel.add (urlField);
    urlField.addActionListener (this);
    fileButton = new JButton ("Browse");
    topPanel.add (fileButton);
    fileButton.addActionListener (this);
    p.add(topPanel, BorderLayout.CENTER);
    setVisible(true);


    }
public void actionPerformed (ActionEvent e) {
 if(e.getSource().equals(fileButton))
try 
        {


        file.showOpenDialog(this);
        mediaFile = "file:/" ;
        mediaFile+=file.getSelectedFile().getAbsolutePath();
        FileName = "";
        FileName += file.getSelectedFile();
        System.out.println(mediaFile);  
        urlField.setText(mediaFile);    


                media = new MediaLocator(mediaFile);
                player = Manager.createPlayer(media);
                        player.addControllerListener(this);
                        wrapRealize();
                        player.prefetch();

    /*      addWindowListener( new WindowAdapter() {
            public void WindowClosing(WindowEvent we) {
                player.stop();
                player.deallocate();
                player.close();

                }
            }); */

            }

    catch (Exception ex){
        ex.printStackTrace();

JOptionPane.showMessageDialog(null,"Invalid File Format","WARNING !!!",JOptionPane.WARNING_MESSAGE); }

    }

    public synchronized void wrapRealize() {
        player.realize();
        while(!realized)
    {
            try {
                wait();
            }
            catch(InterruptedException interupt)
        {
                interupt.printStackTrace();
JOptionPane.showMessageDialog(null,"Invalid File Format","WARNING !!!",JOptionPane.WARNING_MESSAGE);



            }
        }
    }

 public synchronized void controllerUpdate(ControllerEvent event )
    {
        if (event instanceof RealizeCompleteEvent){
            realized = true;
        JFrame playerframe =  new JFrame(FileName);
    playerframe.setSize(300,200);
    playerframe.setLayout(new BorderLayout());
    if ((display = player.getVisualComponent()) != null ) 
        {
playerframe.getContentPane().add(display,BorderLayout.CENTER);

        }

        Component controller = player.getControlPanelComponent();
playerframe.getContentPane().add(controller,BorderLayout.SOUTH); 
    playerframe.setVisible(true);
    notify();   

        }
    else if (event instanceof PrefetchCompleteEvent) 
    {
    player.start();
    }
    else if( event instanceof EndOfMediaEvent)
    {
    player.stop();
    }
    }



     public static void main (String args[]) {
    Player newPlayer = new Player();
     newPlayer.addWindowListener
          (
                 new WindowAdapter()
                 {
                       public void windowClosing(WindowEvent e)
                       {
                             System.exit(0);

                       }
                 }
          );


}

}

View Answers









Related Tutorials/Questions & Answers:
java chat using java media
java chat using java media   Remove the error of this code plz reply...= ""; String FileName = ""; private MediaLocator media; private... = null; public Player() { super("Media Player v1.0"); setSize
Live Chat Application using java
Live Chat Application using java  I want to develop Live Chat Application for my web site, please help me by posting the code or by giving any suggestion, by which i can develop it.... Thanks in advance
Advertisements
Live Chat Application using java
Live Chat Application using java  I want to develop Live Chat Application for my web site, please help me by posting the code or by giving any suggestion, by which i can develop it.... Thanks in advance
java chat?
java chat?  which is the best tool for java web chat ? Is comet a good techonology ? what about its performance with tomacat 6
java chat application
java chat application  Can u plz send me java code for Lan communicatino(chat
java chat application
java chat application  Can u plz send me java code for Lan communicatino(chat
Chat in Java wih GUI
Chat in Java wih GUI  Welcome all >> << how is everybody >< i wanna Chat program in java server & client thanks
chat application - Java Beginners
chat application  i hv created a chat application , but i hav facing problem when i run it in lan , pc ping but apllication doent giv ressponce plz help for these if some one have work on java chat application my email id
program for chat - Java Beginners
program for chat  please provide code for fallowing 1)Write a java program Multi-user chat server and client
chat server in java - RMI
chat server in java  how develope a chat server in java language,not standalone application,i want to develpoe a web base application,please give me a idea,code, this application deployed in a netwok  Hi Friend
chat server in java - JavaMail
chat server in java  sir i was ask u question related to the chat server,and you has given a answer,but sir i want to make a network based chat server ,in network base chat server ,there is no use of the AWT,SWING,in server side
media player - Java Beginners
media player  Sir I need sourcecode similar to mediaplayer.plz give me somes links to get the source code
How to make a chat application using Struts 2 ?
How to make a chat application using Struts 2 ?  Hello, I'm working on my final year project. i've to add chat application in that. how it can be done? 'm using eclipse for that.... plzzz reply
multi user chat server - Java Beginners
multi user chat server  write a multi chat server and client with step by step explanation? please send me this source code to my mail id with step by step explanation
Java Media Framework(JMF) - Java Beginners
Java Media Framework(JMF)  Hi everyone I'm designing a media player using jmf,i am not able to stop and old player and start a new one, the code for starting a new player lies in another class whose constructor has been
Maven dependency for io.getstream - stream-chat-android-client version 5.2.0 is released. Learn to use stream-chat-android-client version 5.2.0 in Maven based Java projects
- stream-chat-android-client version 5.2.0 ) in their Java project if it is based... for using the latest version of io.getstream - stream-chat-android-client in your...Maven dependency for  io.getstream  - Version 5.2.0 of stream-chat
Maven dependency for io.getstream - stream-chat-android-client version 5.17.0 is released. Learn to use stream-chat-android-client version 5.17.0 in Maven based Java projects
- stream-chat-android-client version 5.17.0 ) in their Java project if it is based... for using the latest version of io.getstream - stream-chat-android-client...Maven dependency for  io.getstream  - Version 5.17.0 of stream-chat
Maven dependency for io.getstream - stream-chat-android-client version 5.17.19 is released. Learn to use stream-chat-android-client version 5.17.19 in Maven based Java projects
- stream-chat-android-client version 5.17.19 ) in their Java project... tutorial for using the latest version of io.getstream - stream-chat-android-client...-chat-android-client released The developers of   io.getstream - stream
Maven dependency for io.getstream - stream-chat-android-client version 6.0.4 is released. Learn to use stream-chat-android-client version 6.0.4 in Maven based Java projects
- stream-chat-android-client version 6.0.4 ) in their Java project if it is based... for using the latest version of io.getstream - stream-chat-android-client in your...Maven dependency for  io.getstream  - Version 6.0.4 of stream-chat
Maven dependency for io.getstream - stream-chat-android-client version 5.11.3 is released. Learn to use stream-chat-android-client version 5.11.3 in Maven based Java projects
- stream-chat-android-client version 5.11.3 ) in their Java project if it is based... for using the latest version of io.getstream - stream-chat-android-client...Maven dependency for  io.getstream  - Version 5.11.3 of stream-chat
chat - Java Beginners
how to Create a media player - Java Beginners
how to Create a media player  hi great friends my name is David.please i need a source code with detailed explanation on how to create a media player mp3 format.I need this urgently please!my E-mail address
Maven dependency for nl.vpro.media - media-test version 6.0.2 is released. Learn to use media-test version 6.0.2 in Maven based Java projects
this version ( nl.vpro.media - media-test version 6.0.2 ) in their Java project... 6.0.2 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 6.0.2 java library in your
Maven dependency for nl.vpro.media - media-test version 6.2.3 is released. Learn to use media-test version 6.2.3 in Maven based Java projects
this version ( nl.vpro.media - media-test version 6.2.3 ) in their Java project... 6.2.3 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 6.2.3 java library in your
Maven dependency for nl.vpro.media - media-domain version 6.2.3 is released. Learn to use media-domain version 6.2.3 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 6.2.3 ) in their Java... version 6.2.3 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 6.2.3 of media-domain
Maven dependency for nl.vpro.media - media-test version 7.1.2 is released. Learn to use media-test version 7.1.2 in Maven based Java projects
this version ( nl.vpro.media - media-test version 7.1.2 ) in their Java project... 7.1.2 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 7.1.2 java library in your
Maven dependency for nl.vpro.media - media-test version 7.1.1 is released. Learn to use media-test version 7.1.1 in Maven based Java projects
this version ( nl.vpro.media - media-test version 7.1.1 ) in their Java project... 7.1.1 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 7.1.1 java library in your
Maven dependency for nl.vpro.media - media-test version 7.1.0 is released. Learn to use media-test version 7.1.0 in Maven based Java projects
this version ( nl.vpro.media - media-test version 7.1.0 ) in their Java project... 7.1.0 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 7.1.0 java library in your
Maven dependency for nl.vpro.media - media-domain version 7.1.2 is released. Learn to use media-domain version 7.1.2 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 7.1.2 ) in their Java... version 7.1.2 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 7.1.2 of media-domain
Maven dependency for nl.vpro.media - media-domain version 7.1.1 is released. Learn to use media-domain version 7.1.1 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 7.1.1 ) in their Java... version 7.1.1 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 7.1.1 of media-domain
Maven dependency for nl.vpro.media - media-domain version 7.1.0 is released. Learn to use media-domain version 7.1.0 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 7.1.0 ) in their Java... version 7.1.0 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 7.1.0 of media-domain
Maven dependency for nl.vpro.media - media-test version 7.1.3 is released. Learn to use media-test version 7.1.3 in Maven based Java projects
this version ( nl.vpro.media - media-test version 7.1.3 ) in their Java project... 7.1.3 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 7.1.3 java library in your
Maven dependency for nl.vpro.media - media-domain version 7.1.3 is released. Learn to use media-domain version 7.1.3 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 7.1.3 ) in their Java... version 7.1.3 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 7.1.3 of media-domain
Maven dependency for nl.vpro.media - media-test version 7.1.4 is released. Learn to use media-test version 7.1.4 in Maven based Java projects
this version ( nl.vpro.media - media-test version 7.1.4 ) in their Java project... 7.1.4 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 7.1.4 java library in your
Maven dependency for nl.vpro.media - media-domain version 7.1.4 is released. Learn to use media-domain version 7.1.4 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 7.1.4 ) in their Java... version 7.1.4 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 7.1.4 of media-domain
Maven dependency for nl.vpro.media - media-domain version 6.0.0 is released. Learn to use media-domain version 6.0.0 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 6.0.0 ) in their Java... version 6.0.0 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 6.0.0 of media-domain
Maven dependency for nl.vpro.media - media-domain version 6.1.2 is released. Learn to use media-domain version 6.1.2 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 6.1.2 ) in their Java... version 6.1.2 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 6.1.2 of media-domain
Maven dependency for nl.vpro.media - media-domain version 6.1.1 is released. Learn to use media-domain version 6.1.1 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 6.1.1 ) in their Java... version 6.1.1 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 6.1.1 of media-domain
Maven dependency for nl.vpro.media - media-domain version 6.1.0 is released. Learn to use media-domain version 6.1.0 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 6.1.0 ) in their Java... version 6.1.0 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 6.1.0 of media-domain
Maven dependency for nl.vpro.media - media-domain version 6.0.4 is released. Learn to use media-domain version 6.0.4 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 6.0.4 ) in their Java... version 6.0.4 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 6.0.4 of media-domain
Maven dependency for nl.vpro.media - media-domain version 6.0.3 is released. Learn to use media-domain version 6.0.3 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 6.0.3 ) in their Java... version 6.0.3 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 6.0.3 of media-domain
Maven dependency for nl.vpro.media - media-domain version 6.0.2 is released. Learn to use media-domain version 6.0.2 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 6.0.2 ) in their Java... version 6.0.2 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 6.0.2 of media-domain
Maven dependency for nl.vpro.media - media-domain version 6.0.1 is released. Learn to use media-domain version 6.0.1 in Maven based Java projects
this version ( nl.vpro.media - media-domain version 6.0.1 ) in their Java... version 6.0.1 in Java projects. Follow the step by step tutorial for using...Maven dependency for  nl.vpro.media  - Version 6.0.1 of media-domain
Maven dependency for nl.vpro.media - media-test version 6.1.2 is released. Learn to use media-test version 6.1.2 in Maven based Java projects
this version ( nl.vpro.media - media-test version 6.1.2 ) in their Java project... 6.1.2 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 6.1.2 java library in your
Maven dependency for nl.vpro.media - media-test version 6.1.1 is released. Learn to use media-test version 6.1.1 in Maven based Java projects
this version ( nl.vpro.media - media-test version 6.1.1 ) in their Java project... 6.1.1 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 6.1.1 java library in your
Maven dependency for nl.vpro.media - media-test version 6.1.0 is released. Learn to use media-test version 6.1.0 in Maven based Java projects
this version ( nl.vpro.media - media-test version 6.1.0 ) in their Java project... 6.1.0 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 6.1.0 java library in your
Maven dependency for nl.vpro.media - media-test version 6.0.4 is released. Learn to use media-test version 6.0.4 in Maven based Java projects
this version ( nl.vpro.media - media-test version 6.0.4 ) in their Java project... 6.0.4 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 6.0.4 java library in your
Maven dependency for nl.vpro.media - media-test version 6.0.3 is released. Learn to use media-test version 6.0.3 in Maven based Java projects
this version ( nl.vpro.media - media-test version 6.0.3 ) in their Java project... 6.0.3 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 6.0.3 java library in your
Maven dependency for nl.vpro.media - media-test version 6.0.1 is released. Learn to use media-test version 6.0.1 in Maven based Java projects
this version ( nl.vpro.media - media-test version 6.0.1 ) in their Java project... 6.0.1 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 6.0.1 java library in your
Maven dependency for nl.vpro.media - media-test version 6.0.0 is released. Learn to use media-test version 6.0.0 in Maven based Java projects
this version ( nl.vpro.media - media-test version 6.0.0 ) in their Java project... 6.0.0 in Java projects. Follow the step by step tutorial for using the latest... and includes  nl.vpro.media - media-test version 6.0.0 java library in your

Ads