WARNING in APPLET

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fnbhns
    New Member
    • Dec 2007
    • 7

    WARNING in APPLET

    Dear Friend,

    I am new in Jave. right now I am learning Applet but When I am trying to use THREAD in applet, its giving the following warning & when runinng the file through appleviewer just blank applet displaying.

    ////* Note : Java Uses or Overloads a Depricated API.
    Note : REcompile with -XLint : Deprication for details.

    Tool Completed Successfully *///////

    Friends I m highly expecting your kind support about the solutions.Thaki ng you all.
  • sukatoa
    Contributor
    • Nov 2007
    • 539

    #2
    Originally posted by fnbhns
    Dear Friend,

    I am new in Jave. right now I am learning Applet but When I am trying to use THREAD in applet, its giving the following warning & when runinng the file through appleviewer just blank applet displaying.

    ////* Note : Java Uses or Overloads a Depricated API.
    Note : REcompile with -XLint : Deprication for details.

    Tool Completed Successfully *///////

    Friends I m highly expecting your kind support about the solutions.Thaki ng you all.
    You may review your implementation if you have used deprecated API.....

    I wonder why you are warned "Overloads a deprecated API"....

    Can you post your code?

    To avoid disappointment, you have to limit your expectations.


    hard to imagine,
    sukatoa

    Comment

    • fnbhns
      New Member
      • Dec 2007
      • 7

      #3
      Originally posted by sukatoa
      You may review your implementation if you have used deprecated API.....

      I wonder why you are warned "Overloads a deprecated API"....

      Can you post your code?

      To avoid disappointment, you have to limit your expectations.


      hard to imagine,
      sukatoa
      /////////////////////////////////////////////////////////////////////
      import java.awt.*;
      import java.applet.*;
      import java.util.Date;

      public class ThreadExample extends Applet implements Runnable
      {
      Thread clockThread;
      TextField clockField;
      Date date;
      boolean running = true;

      public void init()
      {
      setLayout(new BorderLayout()) ;

      clockField = new TextField();
      add(clockField, "Center");
      clockThread= new Thread(this);
      clockThread.sta rt();
      }

      public void destroy()
      {
      running = false;
      clockThread = null;
      }


      public void run()
      {
      while (running)
      {
      date = new Date();
      String time = date.getHours() +":"+date.getMi nutes()+":"+dat e.getSeconds();
      clockField.setT ext(time);
      try
      {
      clockThread.sle ep(500);
      }
      catch (InterruptedExc eption e)
      {
      System.out.prin tln(e);
      }
      }
      }
      }

      The above code just to display the clock on the applet. at the time of compilation its giving that warning only but no error, when I run this file by applet viewer, its just show me the blank applet. Specially when I am using any Threads for applet that time I am faceing this problem.

      Thanking you,

      Comment

      • sukatoa
        Contributor
        • Nov 2007
        • 539

        #4
        Originally posted by fnbhns
        /////////////////////////////////////////////////////////////////////
        import java.awt.*;
        import java.applet.*;
        import java.util.Date;

        public class ThreadExample extends Applet implements Runnable
        {
        Thread clockThread;
        TextField clockField;
        Date date;
        boolean running = true;

        public void init()
        {
        setLayout(new BorderLayout()) ;

        clockField = new TextField();
        add(clockField, "Center");
        clockThread= new Thread(this);
        clockThread.sta rt();
        }

        public void destroy()
        {
        running = false;
        clockThread = null;
        }


        public void run()
        {
        while (running)
        {
        date = new Date();
        String time = date.getHours() +":"+date.getMi nutes()+":"+dat e.getSeconds();
        clockField.setT ext(time);
        try
        {
        clockThread.sle ep(500);
        }
        catch (InterruptedExc eption e)
        {
        System.out.prin tln(e);
        }
        }
        }
        }

        The above code just to display the clock on the applet. at the time of compilation its giving that warning only but no error, when I run this file by applet viewer, its just show me the blank applet. Specially when I am using any Threads for applet that time I am faceing this problem.

        Thanking you,
        maybe you forgot to read Deprecated methods on Date class.

        DateFormat and Calendar can figure it out. You can still use other methods in Date except those deprecated....

        Update us,
        sukatoa

        Comment

        • sukatoa
          Contributor
          • Nov 2007
          • 539

          #5
          [CODE = html]<html>
          <head>
          <title>TESTIN G</title>

          <body>

          <applet name=ThreadExam ple code=ThreadExam ple.class>SUKAT OA</applet>

          </body>

          </head>

          </html>[/CODE]

          That was the html i used to test your code.... no problem... your code is correct...

          Are you sure about your html code? maybe you need to post it in HTML forum and ask about what's wrong with your html code....

          If they answered correct, maybe the java is not enabled in your browser


          Update us....
          sukatoa

          Comment

          • sukatoa
            Contributor
            • Nov 2007
            • 539

            #6
            Oppps!!! hahahh :)... i thought it was from browser.... "applet viewer"

            So, kindly test you code in the browser....

            Applet Viewer is just a quick browser for you applet... and @ the end, you will use browser.... So, why don't you use browser to test you code....

            Safari is also good on applets....

            kind regards,
            sukatoa

            Comment

            Working...