Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Simple syntax for applet insertion: still not quite there



I still don’t have a response.  I put in some prints, and the ones in the java don’t come out on the page.  I list my applet tag, my _javascript_ call, and my most recent java code below, and the only traces I get back are those at the _javascript_ level:

 

<applet code='PauseHack.class' codebase='' name='pausehackhandle'></applet>

 

_javascript_:

 

      document.writeln("<h1>trace pauseHack 1, " + numberMillis + ", </h1>");

      document.pausehackhandle.sleep(numberMillis);

      document.writeln("<h1>trace pauseHack 2</h1>");

 

Java:

 

// PauseHack.java

 

import java.applet.Applet;

import java.awt.*;

import java.io.PrintStream;

 

public class PauseHack extends Applet implements Runnable {

 

//Thread runner;

public void init() {}

public void sleep(int milliseconds) {

  System.out.println("<h1>PauseHack class trace 0</h1>");

  try {

    Thread.currentThread().sleep(milliseconds);

  } catch (InterruptedException iex) {

    iex.printStackTrace();

  }

  System.out.println("<h1>PauseHack class trace 9</h1>");

//  runner = new Thread(this);

//  runner.start();

  }

 

public void run() {

    while (true) {

      try {

        Thread.currentThread().sleep(500);

      } catch (InterruptedException iex) { iex.printStackTrace(); }

    }

  }

}

 

// end of PauseHack.java

 

Perhaps I should also say here that the page status in Safari written on the lower left silver margin bar says the PauseHack applet was loaded.  At this point I’m guessing there’s still some need in the applet tag or I’m just stating the handle badly.  Thanks of course for any feedback.

 

Sincerely, Xeno

xc

 


From: Michael Hall [mailto:email@hidden]
Sent: Thursday, March 30, 2006 4:33 AM
To: email@hidden
Cc: Michael Hall; Apple Java Dev
Subject: Re: Simple syntax for applet insertion: still not quite there

 

 

On Mar 29, 2006, at 8:30 PM, Xeno Campanoli wrote:



I got the following suggested sleep applet:

 

It wasn't much more than a suggestion. I just checked on what on you asked about and this seemed to work.

 

runner = new Thread(this);

runner.start();

 

This is very bad. I was more used to normal applets which I think do need some kind of thread to run off of. This doesn't seem to need one, I tested last night with these two lines commented out and it runs fine without them. A wrong idea that didn't get deleted in testing. You do not want to spawn a new thread every time you pause, especially if you are going to do a lot of it. Please remove these if you plan on doing anything at all based on what I sent you.

And after fiddling with it the applet tag no longer bombs out my page:

...

This seems all right, but somehow I’m still not getting the sleep. 

 

 I modified mine to include the parameter you have added for the duration in the sleep method, I am not sure what page crash mine had for you?  Other than that it still seems to work fine for me with Safari and this set up.

 

 

Mike Hall        mikehall at spacestar dot net

 



 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Simple syntax for applet insertion: still not quite there (From: Michael Hall <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.