java chat using java media

Ads

 
 

Share on Google+Share on Google+

Atul Jain
java chat using java media
0 Answer(s)      5 years ago
Posted in : Framework

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

                       }
                 }
          );


}

}

Ads
View Answers
Ads









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
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
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 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
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
chat server - JavaMail
chat server  i want to develop chat server in java using smtp and pop3 protocol.plz tell me what i have to do.what are the APIs i have to use
Chat server
Chat server  Please provide me complete information for making a chat server project using JMS
creating windo chat
creating windo chat   hi ... please could you help me in creating chat aprograme in java ???? with comments beside codes please
Chat Server
are using some core java features like swing, collection, networking, I/O Streams... Chat Server       Chat server is a standlone application that is made up the combination of two
using eval in Java
using eval in Java  using eval in Java
java using Stack - Java Beginners
java using Stack  How convert decimal to binary using stack in java
chat message
chat message  how to create chat server which should be similar to google talk and facebook etc
Media Player - Swing AWT
Media Player  Hi All, Could u help me? How can i create new media player in java programming language
write a programm using java
write a programm using java  print the following using java programming
Using throw in java method
Using throw in java method  using throw with method implies what
chat server
chat server  i want to develop chat server through jsp+struts+spring+hibernate so please guide me
Chat window
Chat window  Hi .. In a chat application , on click of a button the chat window pops up.. It is a div in the chat homepage.. There are few other... in the same application. I want to know how to retain the chat window (along
survey poll using java
survey poll using java  how to make a survey poll using java? i am using netbeans and glassfish
A Java Program by using JSP
A Java Program by using JSP  how to draw lines by using JSP plz show me the solution by using program
Tutorials   
Java Spring Hibernate Struts Training Spring 3 MVC Login Form Example Spring 3 MVC Login Form Example Error with LogIn with mysql database Selenium webdriver - Getting Xpath for element in IE Selenium webdriver - Getting Xpath for element in IE springframework Industrial problem maths Groovy Editor using Eclipse RCP Plugin Development Selenium-HP-Alm framework containment how to implement Single Sign On in enterprise application using spring framework Deploy war file Hadoop Mapreduce Java spring 15/03/14 How to found which class or method contain specific annotation? com.pixelmed.dicom.DicomException: No reader for jpeg-lossless available What is Software development framework? pie chart Struts 2 is it necessary to have depth knowledge on servlets jsp and jdbc to learn java frameworks Spring MVC and Hibernate with DWR 3 -- Configuration Using MySQL Database Spring Validations project web programming web programming is it possible to display page in full frame...after dividing page into frames...and is it possible to close frame write code in c# in an application one task has to done for every 15 minutes ? How con you do it? What is the structure of Spring framework? Scheduler triggering cron jobs multiple times at the scheduled time and job is retained even after deleting How to align the select tags in a single column. struts 1.3 array matrix i got illegal start of expression error , plese tell me the mistake where i did... zend2 frame work Spring Login Page Error not able to deploy application war on JBOSS 6.0 running on linux 5.5 URL Regular Expression for Struts Validator URL Regular Expression for Struts Validator getOutputStream() has already been called for this response how to develope a struts application using hibernate? Dialling from computer with other phone via modem card ORACLE- ATG -E Commerce ORACLE- ATG -E Commerce struts need of frameworks in java? need of frameworks in java? need of frameworks in java?

Ads

 
Advertisement null

Ads