Home Answers Viewqa Framework java chat using java media

 
 


Atul Jain
java chat using java media
0 Answer(s)      a year 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);

                       }
                 }
          );


}

}

View Answers









Related Pages:
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
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
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
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 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
Open Source Chat
; Open Source APIs for Java Technology Games Welcome to today's Java Live chat...;   Open Source Instant Messaging & Chat written in Java...Open Source Chat Open Source Chat Program FriendlyTalk is a simple
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
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
creating windo chat
creating windo chat   hi ... please could you help me in creating chat aprograme in java ???? with comments beside codes please
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
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
video Chat problam - Swing AWT
video Chat problam  Sir How to implments the concepts of video chat in java. i am trying for video chat which work on internet, but i dont know how... is trying for video chat with expert) could connect with expert autometically
Chat server
Chat server  Please provide me complete information for making a chat server project using JMS
Media Player - Swing AWT
Media Player  Hi All, Could u help me? How can i create new media player in java programming language
Media player design
Media player design  i want to know that how will create media palyer application in java   Program for multiplication of table : class table { public static void main(String args[]) { int a=5
video chat
video chat  Hi , how can implement video chat using jsp and servlet .but not use applet . I want to implement video chatting system in my application (front end is developed JSP & servlet) are used. In my case we can?t
Media Streaming application
Media Streaming application Development media streaming applications for major... applications that uses the media servers to play media content real-time. Applications developed using streaming technologies are: Radio applications
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 application - Development process
chat application  Hi, I need to start a chat application using servlet,jsp for my application it is for a government department. Is it possible to do that using servlet,jsp if yes how? thanx,regards zaks
Ajax Chat
chat messages. People from all over the world can now be in the same chat using...; List of chat application developed in Ajax. These chat applications are very... también las nuevas salas de chat (chat rooms).      
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 and make conference - Ajax
Chat and make conference  i am doing online messenger System in j2ee... in chat windows. if i select one friend which is online then how a new window will be open for chat. How i can referece the page for see the status of online off
how to create chat application in jsp?
Creating Chat application in JSP  Creating Chat application in JSP i am developing online web portal using jsp, i need to communicate with admin, so i need integrate with the chat applicaion through the webportal
how to create chat application in jsp?
how to create chat application in jsp?  i am developing online web portal using jsp, i need to communicate with admin, so i need integrate with the chat applicaion through the webportal
Flash based Chat System - WebSevices
Flash based Chat System  Hi I would like to ask is it advisable putting the chat inside the Flash (integrated with the video), or putting it outside the the Flash using XMPP embedding in a website. What issues / pros
JAVA
JAVA   I M building a media player using jframes using libraries of jmf and done with all things but left with some problems.. 1) not able show the timing of song.. 2) not able to volume functionality
PHP Chat Systems A MySQL Driven
PHP Chat Systems A MySQL Driven Chat Script Tutorial This article will show you how to create a simple chat script using PHP and MySQL database... and paste on your mysql editor or console: create table chat(userid int(10
Best Social Media Tools
Social Media Tools Social media comprises of several sharing based websites.... There are many types of Social Media tools: Social/Professional Networking... made on using Web2.0 and other advanced technologies. Basically these sorts
Java Source code
Java Source Code for text chat application using jsp and servlets  Code for text chat application using jsp and servlets
Benefits of Social Media Marketing
of using Social Media Marketing for promoting your business. You can promote your business quickly and easily using Social Media Marketing. Social Media Marketing...Benefits of Social Media Marketing In this section we will understand
PHP Chat Systems A MySQL Driven Chat Script Tutorial
PHP Chat Systems A MySQL Driven Chat Script Tutorial       This article will show you how to create a simple chat script using PHP and MySQL database. The application will allow visitors
java
java  how access the client and server chat coding   Please visit the following link: Chat Server Thanks
Implementing JSP and embedding Windows Media Player(wmp)
Implementing JSP and embedding Windows Media Player(wmp... Embedding WMP (Windows Media Player) means that you have to attach an external... starting, you have to download Windows Media Player. You can download WMP
Social Media Marketing for Small Business
. These days people are using Social Media sites for various reasons. Companies can use...Social Media Marketing for Small Business We are providing Social Media... Social Media Marketing services for Small Business are well designed and gives
Social Media Marketing
are using Social Media and what they want from Social media? What...Social Media Marketing In this section we will learn about social media marketing. These days Social Media Marketing is one of the most used method
java using Stack - Java Beginners
java using Stack  How convert decimal to binary using stack in java
Using throw in java method
Using throw in java method  using throw with method implies what
write a programm using java
write a programm using java  print the following using java programming
Open Source Media Center
Open Source Media Center Open source media center for Windows Why buy a Media Center PC when you can make your own - fun project for an old PC "Media Portal turns your PC in a very advanced Multi-Media Center / HTPC
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
survey poll using java
survey poll using java  how to make a survey poll using java? i am using netbeans and glassfish
What is Social Media Marketing?
, because the social media network you are using stores information about... that Social Media Marketing is the future and that we need to start using...What is Social Media Marketing? The big question arise in your mind that 'What

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.