Results 1 to 3 of 3
  1. #1
    vikas.902007 is offline Member
    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Default Java uses or overrides a deprecated API,,

    Plz tell me what part of this code is deprecated....??????

    import javax.swing.*;
    import java.awt.*;
    import javax.media.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    import java.io.File;
    import javax.swing.JFileChooser;


    class HelloJMF extends JFrame implements ActionListener
    {
    JFrame frame = new JFrame(" Hello JMF Player");
    static Player helloJMFPlayer = null;
    Component control=null;
    JButton open =null;
    JPanel topPanel;
    JFileChooser fc =new JFileChooser();
    URL fName=null;
    public HelloJMF()
    {


    addControls();

    /*frame.addWindowListener( new WindowAdapter() {
    public void windowClosing(WindowEvent we) {
    HelloJMF.stop();
    System.exit(0);
    }
    });*/
    frame.pack();
    frame.setSize( new Dimension(600,500) );
    frame.setVisible(true);
    frame.setResizable(false);
    //helloJMFPlayer.start();
    }

    void addControls()
    {


    frame.addWindowListener(new MyWindowAdapter());


    open = new JButton("Load");
    //open.setEnables(true);
    open.addActionListener(this);


    topPanel=new JPanel();
    topPanel.setBackground(Color.green);
    topPanel.add(open);
    frame.getContentPane().add(topPanel,BorderLayout.C ENTER);



    }
    public void play(URL url)
    {
    try
    { // method using URL

    helloJMFPlayer = Manager.createRealizedPlayer(url);
    }
    catch( Exception e)
    {
    System.out.println(" Unable to create the audioPlayer :" + e );
    }

    control = helloJMFPlayer.getControlPanelComponent();
    frame.getContentPane().add( control, BorderLayout.NORTH);
    helloJMFPlayer.start();

    }

    public static void stop()
    {
    helloJMFPlayer.stop();
    helloJMFPlayer.close();
    }
    /*public static void main( String args[]){
    HelloJMF helloJMF = new HelloJMF();
    }*/
    public void actionPerformed(ActionEvent ae)
    {
    if(ae.getSource()==open)
    {
    fc = new JFileChooser();
    int rVal = fc.showOpenDialog(HelloJMF.this);
    if(rVal == JFileChooser.APPROVE_OPTION)
    {
    File file = fc.getSelectedFile();
    fName= file.toURL();
    }

    play(fName);


    }
    }

    }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: Java uses or overrides a deprecated API,,

    Please go through Guide For New Members and BB Code List - Java Programming Forum and edit your post accordingly.

    Have you read the API for all constructors and methods used in the code? You'll find your answer there.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default Re: Java uses or overrides a deprecated API,,

    The '-deprecation' flag for the compiler will tell you exactly where you are using a deprecated method.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 11
    Last Post: 05-28-2012, 06:14 PM
  2. java.lang.Thread has been deprecated
    By java@albany in forum New To Java
    Replies: 1
    Last Post: 01-12-2012, 10:12 PM
  3. invoking parent method even though child overrides it...
    By vinod_javaranch in forum New To Java
    Replies: 2
    Last Post: 08-18-2011, 04:33 PM
  4. How to fix Deprecated ApI warning in java program
    By amritpalpathak in forum New To Java
    Replies: 2
    Last Post: 06-22-2010, 04:05 AM
  5. Using Deprecated Methods
    By ravian in forum New To Java
    Replies: 3
    Last Post: 11-23-2007, 07:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •