Sleep or pause function

I am just starting out learning how to program applets so I am not familiar with this. I am creating a maze program which can be found here:
http://www.pages.drexel.edu/~mjm87/MazeThirteen.html
My problem is that I want to the show step by step how the maze is traversed. I am trying to slow the process down using the foloowing function in between steps through the maze:
    public void pause( long numberMillis )
        Date now = new Date();
        long exitTime = now.getTime() + numberMillis;
        while( true )
          now = new Date();
          if( now.getTime() > exitTime )
              return;
    }But when I use this, the applet locks up. It never comes back to life. Is there a way top pause the applet for some amount of time WITHOUT using threads? I don't want to use threads because I don't completely understand the way they work and I am under a dealine to get this completed. Any help would be appreciated.

Threads are the way to go. You create one and have it sleep for a number of milliseconds. The other way is the time honored but poor practice if creating a huge for loop that chews up CPU time. for ( int i=0; i < 1000000;i++) {do something} but you'll never know how long it take on a client machine.

Similar Messages

  • After update to Firefox 8, the pause function on videos no longer works

    I updated both my desktop and laptop to Firefox 8.
    The laptop is a Toshiba and it's OS is Win 7 with Kapersky AV. The laptop has no problems.
    When using Firefox on the desktop, which is a clone, with Win XP as the OS, and Norton AV, all up to date, the pause function on videos often does not work.
    I have been able to play the same videos on this desktop computer using IE 8 and pause them with no problem.
    I need to have the pause function work, because I am interrupted a lot, and it can take me 3 hrs. to watch a one hour video due to that.
    Can anyone help? If not, I'll just have to use IE, though I much prefer Firefox. Thanks.

    The Statusbar is gone and the "lock" with it, as of Firefox 4.0. Security information about a web page is shown by the Site Identity Button.<br />
    The old padlock could give users a false sense that a site is secure by not supplying all of the information about a site and only showed that there is a secure connection that didn't guarantee that you are connected to the right server. The Site Identity Button was introduced in Firefox 3.0 to show more complete "identity" information for HTTPS web pages. <br />
    https://support.mozilla.com/en-US/kb/Site+Identity+Button
    You can add a padlock to the location bar with the Padlock add-on- https://addons.mozilla.org/firefox/addon/padlock-icon

  • Sleep or Delay function

    Hi All
    Is there any Sleep or Delay function available in Indesign Javascript.
    I need that function to proceed my task.
    Sajeev

    Thanks Tomaxxi. It works
    Sajeev

  • Where is the pause function in scout?

    Where is the pause function in scout? I want to pause the monitor, then restart the same one. But it only gave me a new session.

    There is no pause function at the moment. For most of the data settings (especially if you only use low overhead settings like basic telemetry and the ActionScript sampler), the amount of data is very low, so you can run Scout for a long time without running out of memory (I've run Scout profiling content continuously for more than a day, with it using only about a gigabyte of memory).
    For the high overhead settings, memory is more of a problem. For Stage3D, you can start it in "delayed" mode (choose from the dropdown - "immediate" is the default). This still captures all the Stage3D commands, but doesn't load them into memory until you click "start recording" in the Stage3D Rendering panel. When it does, it constructs a condensed version of the earlier commands, so you can still replay subsequent frames (it has all your textures, etc), but without using as much memory. You can only do this once though - there's no way currently to start and stop Stage3D recording.

  • How to get a Pause and un-Pause function into my vi

    Hello there,
    I have created a vi with the following things:
    1) Pressure control
    2) Flow control
    To pause:
    Pressure to high
    Pressure to low
    Flow to high
    Flow to low
    When it is in pause:
    -> the power should be cut of and the valve should be closed
    and the remaing time should stay.
    Un-pause:
    Time start to run again, valve opens and the power on.
    Visualy:
    I have to show on the screen:
    Which thing have activated the pause function and the valeu´s
    I´m using: Labview 6.1 and Fieldpoint hardware
    when you need the vi´s please post a message then i send them
    Tia William

    This is easily done with a state machine architecture. There is a simple example written in LabVIEW 5.0 that can be found here. The state machine is a very powerful way to write programs. There are numerous examples on NI Developer Zone and a couple examples that ship with LabVIEW. Do a search in either to find them.

  • How do I insert a WAIT or a PAUSE function, followed by a constant string of numbers [international code, country code and the destination phone number].

    I'd like to program a LOCAL ACCESS NUMBER, then insert a WAIT or a PAUSE function, followed by a constant string of numbers [international code, country code and the destination phone number]. Dialing the local, US  access number is not an issue, but I can't find any info in the manual on how to insert a WAIT or PAUSE or how to insert the remaining string of international codes and destination phone number. Any help would be appreciated. Thanks!

    How to Add Pauses when you Dial a Number on the Samsung Galaxy Note 3 - For Dummies
    It is also described on page 42 of your owners manual...

  • Pause function on Remote.

    Is it correct that when you use the SCOSCHE passPORT home dock to charge the iTouch 2G when it's in use on a Bose Sound Dock Gen 1 the Pause function on the Bose remote control is disabled?

    Th development team were made fully aware of this irritation by the Beta Testers.
    As for Malcolm in the Middle let hazard a guess it is on Channel 5? It is there fault for not implementing the EPG properly it will be the same with the YouView Box.
    Life | 1967 Plus Radio | 1000 Classical Hits | Kafka's World
    Someone Solved Your Question?
    Please let other members know by clicking on ’Mark as Accepted Solution’
    Helpful Post?
    If a post has been helpful, say thanks by clicking the ratings star.

  • Pause function works, but I loose soundTransform

    I am stumped on pausing a sound and keeping the volume sound transform on play again.  Pause works, but when I play again it plays correctly from pause position; however, the sound transform vol reverts to 1 (100%)
    //soundbed vars
    var mySound:Sound = new theme();
    var sndVol:SoundTransform = new SoundTransform(0.2);
    var channel:SoundChannel = mySound.play(0,2,sndVol);
    /pause function
    musicOn_mc.musPause_mc.addEventListener(MouseEvent.CLICK,togMus);
    function togMus(e:MouseEvent) {
    var pausePosition:int = channel.position;
        if (musOn) {
            channel.stop();
            musicOn_mc.musPause_mc.gotoAndStop("off");
            musOn = false;
        } else {
    //THIS IS THE PROBLEM
           channel = mySound.play(pausePosition);
            // ???? any idea how I would re-apply the sound transform?
    //END OF PROBLEM
            musicOn_mc.musPause_mc.gotoAndStop("on");
            musOn = true;
    Thanks

    If you look in the Help you will see that each time you call play a new channel object is created and assigned the variable - so you lose the old transform. You just need to reassign it...
    channel.soundTransform = sndVol;

  • After upgrade to 10.8.3 Sleep mode not functioning

    iMac
    OSX 10.8.3
    Sleep mode does not function properly.

    In what way is it not functioning properly?  If you go to System Preferences > Energy Saver are the sleep mode times where you want them?  When you logout, do you then click Sleep or do you let the iMac go to sleep according to the settings?  Do you have trouble coming out of sleep mode?

  • Pause function when dialling via 3rd party

    I use Planet Talk, a cheap rate international calling service, to dial international numbers from my Nokia N80. It's a bit of a hassle, because I have to first scribble down the number I'm going to call, then go through the PT number, and then manually type out the friend's number. My old Windows Not-so-smartphone did have one great feature, which was being able to insert a pause into an extended string of numbers. So I could amend my overseas friends' numbers as the PT number, "p", and then their number. When dialling them it would go to PT, pause for 3 seconds - which was enough time for the rerouting to kick in - and then dial the contact's number automatically. Does anyone know of functionality like this in Nokia phones?

    try pressing the '*' key (repeatedly) when you dial/enter the number in Contacts

  • Simulating the Next, Previous, Pause Function keys on older MBP

    Hi all,
    I would like to simulate the function keys on newer MBP and Mac keyboards so I can have global pause, play, forward and back for iTunes.
    I have a Shuttle Xpress and I thought I might be able to assign a key combo to its buttons so I could pause and skip tracks in iTunes even when I am using something else like Maya or Photoshop.
    I use this function all the time on the keyboard for my MacPro because I will need to take calls, or I just want to skip to a new track, but I could Google my way to a solution.
    Thanks!

    With Keyboard Maestro you can program any key or key combination to so whatever you want.  It's a terrific app. I use over 80 macros with it.

  • Pause function

    Hi!
    I made a flash movie with audio and it will be export as exe file.
    Is there a way to set a pause, for example 5 sec. before it starts?
    Thx!
    Ciao!

    If the file normally just runs along the timeline without any controls when it starts, then in the first frame you could use the following code to delay it for 5 seconds...
    stop();
    var sto:Number = setTimeout(waitABit, 5000); // calls the function in 5000 msecs
    function waitABit(){
         play();
    If you have any trouble with this, indicate which version of actionscript your file is using (in the Flash Publish settings)

  • IPod Nano pause function erratic

    I've had my Nano for nearly three weeks now and I'm quite happy with it, no scratches, sound is great, just a gorgeous and well thought out device.
    However, I've come really use the function of pausing the Nano by pulling out the earphone plug. For the most part, this does pause the player as advertised, but not always. I've done the reset thing to see if it would help, but it still occasionally plays on after I've removed the head phones.
    Curious if anyone else has experienced this....

    I just bought an ipod nano for my daughter's birthday 2 months ago and it has just started pausing itself. She has updated the OS to v 1.1, but that didn't seem to help. Any suggestions? Should we send it back?
    P4   Windows XP Pro  

  • IPhone: Recommendation to Apple for a quick pause function for iPod

    First of all, we love our new iPhone, as it has been a lifesaver and helps us efficiently use our time. However, there is one issue that I hope would get resolved: if I listen to music on the phone's iPod function while performing other tasks (type an email, browse the web, etc.), if someone interrupts me and I need to quickly pause the music, I have to 1) hit the home button, 2) hit the iPod button and then 3) hit the pause button on the currently playing song.
    Instead of having to perform three steps, I recommend that Apple updates the software to have a "quick pause" button that would be placed at the top of the iPhone screen in the same way that one would see the green bar at the top of the screen while on a telephone call and performing other iPhone tasks. This would give users one quick and easy way to pause the music that is playing on the iPod!
    Alan

    I like your idea for using the top button as a pause button.
    Why don't you go ahead and submit it to the iPhone feedback page:
    http://www.apple.com/feedback/iphone.html

  • Pause function in Sonyericsson  (K700i,K610i)

    Hi ,
    I created a media player which has usual Play,pause,vol up/down functions.
    (num 5 key is used to both play and pause the sound)
    All these functions works in Nokia phones.
    But when pause(num 5) is pressed in SEricsson it stops the player... when i start(press num 5) again it starts from the begining. It does not resume from the last point.
    Anyone knows how to overcome this problem ?
    Thanx in advance !

    Read this: http://www.j2meforums.com/wiki/index.php/FAQ#Why_doesnt_my_app_switch_between_my_two.2Fthree.2Ffifty-seven_canvases_when_I_call_myDisplay.setCurrent.28nextCanvas.29.3F
    Mihai

Maybe you are looking for

  • Crystal report sample with addon

    Hi !! I'm looking for an addon sample that calls a report made with crystal report and prints it. If anyone could leave a sample code or just e-mail me a sample i would appreciate it very much and it would help me understand the works of it. Thanks a

  • Updating WS proxy files in JDeveloper after updating XSD in BPEL process

    Hi all, I have a couple of BPEL processes with variables from one huge XSD deployed to my server. I have created WS Web proxies for these processes in my application in JDeveloper and I'm calling these processes through these proxies. When I have cre

  • 10.3.9 Start up problems

    I updated my i Mac from classic to os x about a year ago and use the auto updater to keep it current. Lately I have a delay during start up. The computer starts to cuild the desktop and then before it finishes (has not put the HD icon or finished put

  • Exportar datos a un mismo archivo

    Buenas tardes, Estoy con el módulo Sound and vibration Assistant. He grabado una señal de ruido temporal y mi idea es poder pasar cada segundo grabado a un mismo archivo. Es decir, Grabar el espectro en frecuencia del segundo 1 Grabar el espectro en

  • Opening 4.5 xlf files in 2008?

    Anyone else having problems getting 4.5 files to open in 2008? I create a nice simple new xlf with a simple xls behind it and a just a grid component in 4.5, then try open the file in 2008 and i get... Crystal Xcelsius is unable to load this file. Th