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
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
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
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
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
chat - Java Beginners
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 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 org.openjfx - javafx-media version 17.0.0.1 is released. Learn to use javafx-media version 17.0.0.1 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17.0.0.1 ) in their Java... version 17.0.0.1 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 17.0.0.1 java library
Maven dependency for org.openjfx - javafx-media version 17.0.1 is released. Learn to use javafx-media version 17.0.1 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17.0.1 ) in their Java project... 17.0.1 in Java projects. Follow the step by step tutorial for using the latest... and includes  org.openjfx - javafx-media version 17.0.1 java library in your project
Maven dependency for org.openjfx - javafx-media version 14 is released. Learn to use javafx-media version 14 in Maven based Java projects
this version ( org.openjfx - javafx-media version 14 ) in their Java project... in project? Steps to use  org.openjfx - javafx-media version 14 in Java...-media version 14 java library in your project. Now you can save the file
Maven dependency for org.openjfx - javafx-media version 14.0.2.1 is released. Learn to use javafx-media version 14.0.2.1 in Maven based Java projects
this version ( org.openjfx - javafx-media version 14.0.2.1 ) in their Java... version 14.0.2.1 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 14.0.2.1 java library
Maven dependency for org.openjfx - javafx-media version 18 is released. Learn to use javafx-media version 18 in Maven based Java projects
this version ( org.openjfx - javafx-media version 18 ) in their Java project... in project? Steps to use  org.openjfx - javafx-media version 18 in Java...-media version 18 java library in your project. Now you can save the file
Maven dependency for org.openjfx - javafx-media version 16 is released. Learn to use javafx-media version 16 in Maven based Java projects
this version ( org.openjfx - javafx-media version 16 ) in their Java project... in project? Steps to use  org.openjfx - javafx-media version 16 in Java...-media version 16 java library in your project. Now you can save the file
Maven dependency for org.openjfx - javafx-media version 12 is released. Learn to use javafx-media version 12 in Maven based Java projects
this version ( org.openjfx - javafx-media version 12 ) in their Java project... in project? Steps to use  org.openjfx - javafx-media version 12 in Java...-media version 12 java library in your project. Now you can save the file
Maven dependency for org.openjfx - javafx-media version 17 is released. Learn to use javafx-media version 17 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17 ) in their Java project... in project? Steps to use  org.openjfx - javafx-media version 17 in Java...-media version 17 java library in your project. Now you can save the file
Maven dependency for org.openjfx - javafx-media version 13.0.2 is released. Learn to use javafx-media version 13.0.2 in Maven based Java projects
this version ( org.openjfx - javafx-media version 13.0.2 ) in their Java project... 13.0.2 in Java projects. Follow the step by step tutorial for using the latest... and includes  org.openjfx - javafx-media version 13.0.2 java library in your project
Maven dependency for org.openjfx - javafx-media version 14.0.2 is released. Learn to use javafx-media version 14.0.2 in Maven based Java projects
this version ( org.openjfx - javafx-media version 14.0.2 ) in their Java project... 14.0.2 in Java projects. Follow the step by step tutorial for using the latest... and includes  org.openjfx - javafx-media version 14.0.2 java library in your project
Maven dependency for org.openjfx - javafx-media version 14.0.1 is released. Learn to use javafx-media version 14.0.1 in Maven based Java projects
this version ( org.openjfx - javafx-media version 14.0.1 ) in their Java project... 14.0.1 in Java projects. Follow the step by step tutorial for using the latest... and includes  org.openjfx - javafx-media version 14.0.1 java library in your project
Maven dependency for org.openjfx - javafx-media version 15 is released. Learn to use javafx-media version 15 in Maven based Java projects
this version ( org.openjfx - javafx-media version 15 ) in their Java project... in project? Steps to use  org.openjfx - javafx-media version 15 in Java...-media version 15 java library in your project. Now you can save the file
Maven dependency for org.openjfx - javafx-media version 15.0.1 is released. Learn to use javafx-media version 15.0.1 in Maven based Java projects
this version ( org.openjfx - javafx-media version 15.0.1 ) in their Java project... 15.0.1 in Java projects. Follow the step by step tutorial for using the latest... and includes  org.openjfx - javafx-media version 15.0.1 java library in your project
Maven dependency for org.openjfx - javafx-media version 17.0.2 is released. Learn to use javafx-media version 17.0.2 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17.0.2 ) in their Java project... 17.0.2 in Java projects. Follow the step by step tutorial for using the latest... and includes  org.openjfx - javafx-media version 17.0.2 java library in your project
Maven dependency for org.openjfx - javafx-media version 18.0.1 is released. Learn to use javafx-media version 18.0.1 in Maven based Java projects
this version ( org.openjfx - javafx-media version 18.0.1 ) in their Java project... 18.0.1 in Java projects. Follow the step by step tutorial for using the latest... and includes  org.openjfx - javafx-media version 18.0.1 java library
Maven dependency for co.easimart - android-media-picker version 1.0.0 is released. Learn to use android-media-picker version 1.0.0 in Maven based Java projects
; co.easimart - android-media-picker version 1.0.0 in Java projects. Follow...-media-picker version 1.0.0 java library in your project. (adsbygoogle...Maven dependency for  co.easimart  - Version 1.0.0 of android-media
Maven dependency for org.openjfx - javafx-media version 16-ea+6 is released. Learn to use javafx-media version 16-ea+6 in Maven based Java projects
this version ( org.openjfx - javafx-media version 16-ea+6 ) in their Java... version 16-ea+6 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 16-ea+6 java library in your
Maven dependency for org.openjfx - javafx-media version 17-ea+2 is released. Learn to use javafx-media version 17-ea+2 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17-ea+2 ) in their Java... version 17-ea+2 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 17-ea+2 java library in your
Maven dependency for org.openjfx - javafx-media version 17-ea+3 is released. Learn to use javafx-media version 17-ea+3 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17-ea+3 ) in their Java... version 17-ea+3 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 17-ea+3 java library in your
Maven dependency for org.openjfx - javafx-media version 17-ea+6 is released. Learn to use javafx-media version 17-ea+6 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17-ea+6 ) in their Java... version 17-ea+6 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 17-ea+6 java library in your
Maven dependency for org.openjfx - javafx-media version 17-ea+7 is released. Learn to use javafx-media version 17-ea+7 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17-ea+7 ) in their Java... version 17-ea+7 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 17-ea+7 java library in your
Maven dependency for org.openjfx - javafx-media version 17-ea+9 is released. Learn to use javafx-media version 17-ea+9 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17-ea+9 ) in their Java... version 17-ea+9 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 17-ea+9 java library in your
Maven dependency for org.openjfx - javafx-media version 17-ea+11 is released. Learn to use javafx-media version 17-ea+11 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17-ea+11 ) in their Java... version 17-ea+11 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 17-ea+11 java library
Maven dependency for org.openjfx - javafx-media version 17-ea+13 is released. Learn to use javafx-media version 17-ea+13 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17-ea+13 ) in their Java... version 17-ea+13 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 17-ea+13 java library
Maven dependency for org.openjfx - javafx-media version 17-ea+14 is released. Learn to use javafx-media version 17-ea+14 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17-ea+14 ) in their Java... version 17-ea+14 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 17-ea+14 java library
Maven dependency for org.openjfx - javafx-media version 17-ea+15 is released. Learn to use javafx-media version 17-ea+15 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17-ea+15 ) in their Java... version 17-ea+15 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 17-ea+15 java library
Maven dependency for org.openjfx - javafx-media version 11-ea+23 is released. Learn to use javafx-media version 11-ea+23 in Maven based Java projects
this version ( org.openjfx - javafx-media version 11-ea+23 ) in their Java... version 11-ea+23 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 11-ea+23 java library
Maven dependency for org.openjfx - javafx-media version 13-ea+5 is released. Learn to use javafx-media version 13-ea+5 in Maven based Java projects
this version ( org.openjfx - javafx-media version 13-ea+5 ) in their Java... version 13-ea+5 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 13-ea+5 java library in your
Maven dependency for org.openjfx - javafx-media version 17-ea+16 is released. Learn to use javafx-media version 17-ea+16 in Maven based Java projects
this version ( org.openjfx - javafx-media version 17-ea+16 ) in their Java... version 17-ea+16 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 17-ea+16 java library
Maven dependency for org.openjfx - javafx-media version 18-ea+1 is released. Learn to use javafx-media version 18-ea+1 in Maven based Java projects
this version ( org.openjfx - javafx-media version 18-ea+1 ) in their Java... version 18-ea+1 in Java projects. Follow the step by step tutorial for using... and includes  org.openjfx - javafx-media version 18-ea+1 java library in your

Ads