Stop a timer that triggers progress bar

This timer triggers a progress bar. The goal is to stop the timer (and therefore the progress bar) when a label changes its text.
However, the timer goes on for ages and the progress bar keeps going until it reaches 100%. The timer never stops, it just that the progress bar can't go any further.
In other words,
1. How do you stop the timer below?
2. How do you make this timer below to listen to other events such as threads terminated or label text change?
Feel free to tweak around the code below so I can see what you mean. I learn by example.
Thanks in advance,
  int i = 0 ;
  public void timer2 ()
    Timer t2 = new Timer ( 10000, new ActionListener () //10 seconds
      public void actionPerformed ( ActionEvent event )
        progressBar.setValue ( i ) ;
        progressBar.setStringPainted ( true ) ;
        i++ ;
    t2.start () ;
    if ( lblStatus.getText ().equals ( "CD succesfully created" ) ) {
      i = 100 ;
      progressBar.setValue ( i ) ;
      progressBar.setStringPainted ( true ) ;
      t2.stop () ;
  }

Thanks John. You can tell I'm a newbie huh.
Where do I put the property listener for the label?
If I put the listener inside the timer I get a compilation error saying that an "identifier is expected beginning at 'CD successfully completed' "
int i = 0 ;
  public void timer3 ()
    Timer t3 = new Timer ( 5000, new ActionListener () //5 seconds
       public void actionPerformed ( ActionEvent event )
        progressBar.setValue ( i ) ;
        progressBar.setStringPainted ( true ) ;
        i++ ;
    t3.start () ;
   lblStatus.addPropertyChangeListener("CD successfully completed", new PropertyChangeListener() {
                           public void propertyChange(PropertyChangeEvent evt) {
                                   t3.stop();
                   } );if I put the property listener inside, I get a different error "the variable t3 is being accessed from within inner class and that it needs to be declared final."
  int i = 0 ;
  public void timer3 ()
    Timer t3 = new Timer ( 5000, new ActionListener () //5 seconds
       public void actionPerformed ( ActionEvent event )
        lblStatus.addPropertyChangeListener("CD successfully completed", new PropertyChangeListener() {
                         public void propertyChange(PropertyChangeEvent evt) {
                                 t3.stop();
        progressBar.setValue ( i ) ;
        progressBar.setStringPainted ( true ) ;
        i++ ;
    t3.start () ;

Similar Messages

  • Problem installating Snow Leopard on old Macbook Pro with Intel Core 2 Duo. After creating partition on internal hard disk (Extended Journaled), installation starts but stops at half of the progress bar. Screen asking Restart appears.

    Hello:
    I have tried installing Snow Leopard via the installation disc on a Macbook Pro (2007) with an Intel Core 2 Duo, but I the installation has failed more than 5 times.
    I have first formatted and partitioned the internal hard disk with Mac Os Extended Journal format.
    Once the installation starts, it starts without a problem unti lthe progress bar gest until half completed then a screen asking for a Computer Restart shows up.
    It asks to press the power button for some time until it the computer shuts down and then, press again to turn it on.
    Once turned on, the installation disc gets readed, the installation screen appears again and asks again to start the whole installation process form the beginning.

    Then you have a Hardware Problem.
    Your system is Crashing part way through the install and Re-Booting because of the crash.
    Could be the drive itself or it could be some other hardware part in your system. Like the RAM.
    To check if it is the internal drive connect an External drive to the system by USB and do the install on that external. If the install completes then it more then likely the drive is bad. If it crashes again then it is more then likely some other piece of hardware in your system.

  • Reset timer after user selection + Progress bar

    Hello there!
    I am trying to create a VI for humidity. So far everything works fine for that. I also wanted the ability to let the user define the frequency of data collections in units of time. ie: every <x> minutes/hours/days/etc. This also works to some extent.
    My problem is that say I choose 1 second, then change the unit to 1 minute. It'll do exactly as expected: the VI will wait 1 minute until capturing a data point. The problem is what if the user changes it back to seconds before that minute is over. The VI will still wait the full minute before changing to the new collection frequency unit.
    Is there someway to force reset the timer if the user changes a selection?
    Also, I am trying to make a progress bar to let the user know how far the VI is along with the collection interval. I thought it'd be convenient if a user selects 1 hour for example. There is no way of knowing how far along that hour wait is. I can't seem to get this one to work either. I thought it'd be something like
    1)get current date/time seconds
    2)add the user interval (ie: 60 seconds) to #1
    3) get a %
    4) add that to progress bar
    5) if reaches 100, then reset.
     Also for some reason my STOP button doesnt work for this loop.....
    Any help on this would be great! I've attached the VI I have going thus far.
    thanks so much
    Attachments:
    Humidity.png ‏41 KB

    Ah, sorry about that I thought I also attached the VI.
    Since this is my first VI, I'm not sure what you mean by:
    altenbach wrote:
    Easiest would be to use the timeout of an event structure to trigger a collection. Use other events to immediately break the timout and apply new settings, etc..
    Here ya go!
    Attachments:
    Vaisala HMD40Y_2013_SP1.vi ‏85 KB
    Units to Seconds.vi ‏19 KB

  • Trouble with current playback time on progress bar

    First, some terminology.
    As Adobe Flash Player is preparing to play a video, it displays a spinning icon in the center of the video window.  I have seen web pages which refer to this as the spinning beach ball.  I will refer to this simply as the "spinning icon".
    While Adobe Flash Player is playing a video, when one hovers the cursor over the video window (or moves the cursor while playing the video in full screen mode), one sees a progress bar at the bottom of the window.  To the left of the progress bar is a pause button.
    The progress bar has a pointer representing the current playback time within the video.  The progress bar also has a display of the current playback time and length of the video (eg, 40:37 / 01:12:35, meaning that play back is at 40 minutes and 37 seconds within a video which is 72 minutes and 35 seconds long).
    On my Windows XP system, when Flash Player V10.0.32.18 is playing a streaming video, the video pauses when bandwidth is momentarily insufficient to deliver the video bit stream.  The spinning icon appears in the center of the video window.  The current playback time on the progress bar also pauses, as it should.  But when the video resumes, the current playback time does not begin incrementing again.  It remains stalled at the time the pause occurred, which is irritating because it is no longer possible to tell how much time remains in the video.
    It took me a very long time to discover that once the current playback time has stalled, pressing the pause button will cause the current playback time to refresh to the correct playback time and begin incrementing again.  Yaaayyyyyy!
    Now, perhaps someone can help me with a challenge I have been unable to solve.
    On occasion, I want to back up a few seconds within a video.  But if I use my mouse to grab the pointer within the progress bar and move it backward, moving the pointer only a few seconds is a huge challenge.  Even a slight movement of my mouse moves the pointer back a minute or two.
    Is there a way to move the pointer using a key (eg, an arrow key) so that each key press moves the pointer back only a second or two?
    And how about being able to key in a time and press enter, thereby causing the pointer to move to the specified time? Any way to do that?

    Hi OSW, Thanks, now if the NPSWF (FF) files listed are 10.0.32.18 which I'm sure they are, then your FF Flash files are correct. You can right click on each of those and click Properties to confirm the version numbers. Then you have the SWF that is correct. So you have FF Flash files and the SWF, so you are ok on FF.
    IE is a different story. That FIDbg10c.ocx should not be there, it should be Flash10c.ocx to match the FlashUtil10c.ocx.
    Now as far as doing what you suggested, in a word NO. First of all the plug-in is normally used as referring to FF or other browsers than IE. ActiveX is used for IE. If you ran the uninstall_plug-in.exe, you would be removing your FF add on, so don't do that since all of your related Flash files for FF are intact. (Do not disturb:-)
    Now the proper way to Uninstall is to use the Adobe Uninstaller that is downloaded to your Desktop. Then the IE Flash Player Installer is likewise downloaded to the Desktop. Then the FF Installer is downloaded to your Desktop. That way it seems to work better. Also the following must be taken into consideration. Any Anti-Virus/Spyware/Firewall can block
    the install of the ActiveX Control for IE. You must run in the Administrative mode or be the Administrator to install the
    ActiveX and write to the Windows Registry, which Flash Player does on the Install.
    Keep in mind that an Uninstall will remove Flash Player files and the SWF and the SWO for ALL browsers. Then the IE Installer is used to Install FP and the SWO for IE. Then the FF Installer is used to Install the FP & SWF for FF.
    Trying to update or download the Flash Player latest version does not remove the old versions as some software installs do. The old versions must be removed by the Adobe FP Uninstaller prior to any download of the new version.
    I have to be offline for a time. Will check back in later. Just wanted to give you some info on this. There are a couple of things that can be done, and will explain later. If you are satisfied with FF & IE with how Flash Player is working, you don't have to do anything. Again, the update may not accomplish the progress bar issue either. So it is something to think about.
    Thanks,
    eidnolb

  • How do stop the progress bar disappearing during sync?

    When I'm syncing my iPod Classic to my iTunes I will see a progress bar at the top of iTunes showing how far it has progressed and text letting me know which track of how many I'm on.  But this information will only appear for a second or two before being replaced by the text: "Synching iPod Do Not Disconnect".  The warning will remain visible for aproximately two minutes.  How do I change it so that the progress bar remains visible constantly and the warning does not appear?  Failing that how do I change it so that the information I wish to see remains on screen longer and the warning appears only briefly?

    Press the escape (esc) key to exit full-screen mode.

  • How to determine a sql query size to display a progress bar

    I would like to show a progress of an sql query within a jsp page.
    Background:
    I have a reporting web application, where over 500 contacts can run reports based on different criteria such as date range....
    I current display a message stating 'executng query please wait', however the users (hate users) do not seem to wait, thereofore they decide to run the query all over again which affected my reportign sever query size (eventually this crashes, stopping all reports)
    Problem:
    The progress bar is not a problem, how would I determine the size of the query at runtime therefore adding the time onto my progress bar.

    Yes it's doable (we do it) but it sure ain't easy.
    We've got about 23,500,000 features (and counting) in a geodata database. Precise spatial selection algorithms are expensive. Really expensive.
    We cannot impose arbitrary limits on search criteria. If the client requires the whole database we are contractually obligated to provide it...
    For online searches We use statistics to approximate the number of features which a given query is likely to return... more or less the same way that the query optimiser behind any half decent (not mysql (5 alteast)) database management system does.
    We have a batch job which records how many features are linked to each distinct value of each search criteria... we just do the calculations (presuming a normal (flat) distribution) and...
    ... if the answer is more than a 100,000 we inform the user that the request must be "batched", and give them a form to fill out confirming there contact details. We run the extract overnight and send the user an email containing a link which allows them to download the result the next morning.
    ... if the answer is more than a million features we inform the user that the request must batched over the weekend... same deal as above, except we do it over the weekend to (a) discourage this; and (b) the official version ensure we have enough time to run the extract without impinging upon the maintenance window.
    ... if the answer is more than 5 million we display our brilliant "subscribe to our DVD service to get the latest version of the whole shebang every three months (or so), so you can kill your own blooody server with these ridiculous searches" form.
    Edited by: corlettk on Dec 5, 2007 11:12 AM

  • Initial progress bar stuck

    We have a Flex 1.5 app our clients use. 99.9999% of the time
    when our sales people go on a demo for a potential client, the app
    loads just fine. That .0001% of the time, the initial progress bar
    gets to a certain percentage and just sticks. In one situation,
    having the sales person demoing use or install Firefox on the
    client’s machine did the trick. We have a similar situation
    with a potential client and we have tried everything. We’ve
    cleared caches on both browsers, we’ve uninstalled and
    reinstalled the Flash plug-ins for both IE and
    Firefox…we’ve upgraded to IE 7…no matter what we
    do, the app loads up and stops at 8%. It loads for every other
    existing client and every other demo sales goes on…it loads
    on all of our local machines in-office…this one single
    client’s office cannot load the app…and the best part
    is, it loaded for them last week when the sales first went to demo.
    They went in for round two this past week and the app will not pass
    8% on any of their machines.
    Any suggestions?

    I have seen behavior like this when an application is near
    the 32k limit.
    How are you running the app? Always from a Flex server? If
    so, a suggestion for debugging is to compile the swf on a maching
    the works, and then call it from a custom wrapper.
    It might be worth trying this i reverse as well, saving the
    swf on the non-functional system and running it directly from a
    wrapper on a system that it has been working.
    The 32k limit issue involves the compilation on the Flex
    server, If a swf get generted and compiles and run successfully on
    one system, it should run on all.
    Hmm, even before that, try running the app with debug=true,
    on the non-functional system. The debug switch causes code to get
    generated into the swf that changes the way it get compiled. Often,
    this will either overcome the 32k problem, or will display it
    clearly.
    See the FAQ on CFLEX.net for more details on the 32k issue.
    Tracy

  • Update progress bar from repeater events

    I have a component that uses a repeater to download and set information on a collection of items from the internet.  This can take a while, so I tried to set up a panel with a progress bar to provide some feedback.
    Problem is, when the repeater is executing, it apparently doesn't yield time so the progress bar can update. (?!)
    The end result is that the progressbar doesn't show anything until the repeater is done, at which point it shows the last value the repeater loaded.
    So, is there a way to get around this?  Can the repeater be triggered with timer ticks, instead of blindly looping?
    Scouring the docs, but nothing is showing, yet.  At worst case, I guess I can bag the repeater and just fetch the items in a timer driven loop, rather than use the repeater mechanism.  Would be a drag, but I need the progress bar to update.
    Any thoughts appreciated.
    rickb

    Changing to window made no difference.
    One solution is to show the document being built, now its hidden. Another would be to show the progress in a palette.
    I have never built a palette, is it possible to have a swf-file that triggers javascript?
    Is it possible to add buttons to the palette menu on the top right?
    But solving this would be the easiest...

  • TS3694 hi i recently updated into ios 7.0.4 now i want to fully restore my ipad to resell but when i restore it it got stuck with apple logo and progress bar with 45% completed as firware file is downloaded using ipad 4 wifi itunes 11.3.8

    hi i rescently updated my ipad 4 in ios 7.0.4 and for resell purpose i want to restore my ipad via itunes but it got stuck at apple logo and progress bar of 45% completed i tried it 50 times but it stuck on that exact point for hours i cant able to restore it and had no errors it just like freezes at one point i also uses dfu mode but got stuck at same problem using windows 7 32 bits itunes 11.3.8 ipad 4 wifi please help

    My iPhone 5 wouldn't start after I turned it off a few minutes after writing this. It went into recovery mode and I had no choice but to connect to iTunes on PC and restore.
    I restored to factory setting first, just to validate my phone was okay. For a second consecutive iOS update, the  iPhone 5 did not update smoothly while connected to PC and iTunes - I had to retry two times before the progress bar for the update showed. (The exact same problem with the restart occured when I updated to 7.0.4.)
    The good news is that I was ultimately able to restore the iPhone 5 to factory settings while running iOS 7.0.6. I did have a backup from about a month ago lying around and was able to successfully restore with that as well, so the damage done is almost negligible since I had my contacts, notes, mail, etc. backed up to iCloud.
    Once I completed both restores, the sync with iTunes worked fine.

  • How can I use a progress bar in objective c mac

    How can I use a progress bar in objective c mac? I have a code that downloads a file and I want to be able to let the progress bar increase by 1. A bit further on the code (to download the file) it needs to increase again. And so on...
    My code
    -(IBAction) downloadButtonPressed:(id)sender;{
        //get the path to the image that we're going to download
        NSURL *url = [NSURL URLWithString:@"https://www.dropbox.com/s/l6o07m48npxknt4/Cluedo.zip?dl=1"];
        //get the path to documents folder where we're going to save our image
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *DocumentsDirectory = [paths objectAtIndex:0];
        NSString *filePath = [DocumentsDirectory stringByAppendingPathComponent:@"Cluedo.zip"];
        //Download the file to memory
        NSData *data = [NSData dataWithContentsOfURL:url];
        NSError *error = nil;
        //Save it on the Documents directory
        [data writeToFile:filePath options:NSDataWritingAtomic error:&error];
        NSFileManager* fm = [NSFileManager defaultManager];
        NSString* zipPath = filePath;
        NSString* targetFolder = @"/Applications"; //this it the parent folder
        //where your zip's content
        //goes to (must exist)
        //create a new empty folder (unzipping will fail if any
        //of the payload files already exist at the target location)
        [fm createDirectoryAtPath:targetFolder withIntermediateDirectories:NO
                       attributes:nil error:NULL];
        //now create a unzip-task
        NSArray *arguments = [NSArray arrayWithObject:zipPath];
        NSTask *unzipTask = [[NSTask alloc] init];
        [unzipTask setLaunchPath:@"/usr/bin/unzip"];
        [unzipTask setCurrentDirectoryPath:targetFolder];
        [unzipTask setArguments:arguments];
        [unzipTask launch];
        //[unzipTask waitUntilExit]; //remove this to start the task concurrently

    Your code really isn't suitable for a progress bar, not a real one anyway. Your code will spend about 99.9% of its time in the method "dataWithContentsOfURL:url". That is not a method you want to use in the real world. It is only for demos or proof of concept exercises. All network operations should be asynchronous. That gives you the ability to gracefully recover when there is a failure and also to do fancy things like display a progress bar and tell the user when the download is complete.
    Once you get the asynchronous download logic working, then you can worry about the progress bar. The first thing you will need is the size of the file. Without that, all you can ever do is an indeterminate progress bar or spinner. If you have the size of the file, then you can keep track of how much of the file you have downloaded and update your progress bar with the percentage complete. Make sure to throttle it to no more than incrementing by 1% at a time. Otherwise, a large file or a file transferred in many small chunks, would waste too much time updating the progress bar for no change.

  • Help With Zen Vision:M 30G, lost alot of music, "rebuilding" progress bar doesnt fin

    I purchased my Zen Vision:M 30GB player about 5 months ago and its been great untill today I turned it on and it froze, so i hit the reset button.
    Heres the thingI reset it and that "Rebuilding" progress bar poped up like it has in the past when i hit reset?But this time the progress bar only got about? /6th of the way full, before the unit returned to its normal menu, and i went to look at my music and about 90% of it is gone! Ive done a restart in the past and the rebuilding progress bar would have to fill up all the way before it would go to the normal menu and i had no problems with it then, just today it started doing the thing where it would only go /6th the way. Heres the weird stuff,I went to look at the system information to look how much memory was left and based on the numbers, my 90% of missing music should still be on there somewhere. I tried connecting it to my computer and all the sudden now my computer decides to recognize it but The Creative Media Explorer will say its not connected, that is a first for me too?I tried doing that system recovery thing, where i did the scan disk but that did not help at all. Everytime i try to re-boot or re-start it does that thing where the "Rebuilding" progress bar only goes /6th of the way before it goes back to the normal menu, i think that has somthing to do with it. Any help would be GREATLY appreciated?Message Edited by Lowalkoroc on 03-7-20070:20 PM
    Message Edited by Lowalkoroc on 03-7-20070:20 PM

    I was just about to post a topic about this. I had the same problem and after numerous efforts I decided to follow the "Format (All)" instructions [url="http://forums.creative.com/creativelabs/board/message?board.id=dap&message.id=5530#M5530">here[/url]. After a reformat, a reboot, and a reload of all my songs everything is working again. Thank the Lord and the Creative forums.

  • Progress bar in compressor 4.1.2 not working - Why

    While in the active window compressor is working but does not give me a progrss time or a progress bar - so I have to walk away and wait a couple of hours not knowing the movie is compressed.  Why?

    In the process of doing a screen shot - I discovered that the progress bar and timer work fine if I use  any setting except ProRes 442.  Not sure I know why?

  • No Progress Bar when importing from Camera

    I just updated to iLife 06, and I noticed when I was importing new photo's into iPhoto 6, that the progress bar does not move. The photo's import fine, but I have no idea of the approximate time it will take, since the progress bar never shows up.
    Has anyone else seen this? Is there any pref files I can clean out to see if I can get this feature back?
    Thanks, and sorry if this has been discussed, but I could not find anything when searching the forums for this issue.
    - Bruce

    Well, I just imported 10 photo's and the progress bar worked. My previous import where the progress bar did not work, had 125 photo's, with two of them locked. I have removed the locked photo's, and removed the regular photo's, and now the progress bar works. I do not know if it was because there was 125 photo's or if it was because I had a few locked photo's, but now it seems to be working.
    I will test things out by locking some more photo's and seeing if the progress bar shows up when I import. I also chose to delete the original photo's after importing them.
    Has anyone else imported a lot of pictures, and had a few locked on the camera, and noticed if the progress bar works or not?
    - Bruce

  • Progress bar for chart dataProvider?

    I have a chart which has for dataProvider a link to a php
    script which processes data and returns XML.
    The processing takes a little bit of time so from flex the
    user stares at a blank graph for some time.
    Is there anyway to link a progress bar to this loading
    process?
    If I load the script directly from the browser, the browser's
    progress bar (bottom right in IE) is more or less accurate. I would
    like the equivalent from within flex.
    Any input appreciated, thanks!
    sample:
    <mx:PlotChart
    id="molecularChart"
    width="100%" height="100%"
    dataProvider="
    http://www.blabla.com/processing.php"
    showDataTips="true">
    ...

    If you are trying to update the progress bar display when your upload is 10%, 20%, , , x% complete, then you have to 'pretend' that the progress bar display corresponds to the percentage completness of your file upload. I believe that there is no other way to get around this without comprimising the speed of your upload.
    Check out the swing forum, I believe there is a lot of discussion on this topic.

  • ITunes progress bar freezes iTunes, kinda.

    So I just got my HD replaced. My iTunes library file (the .xml file) became corrupted. I started a new Library. I'm now in the midst of adding new songs, not the songs that I originally had in my iTunes. What happens though anytime I edit the id3 tags for more than one mp3. So lets say I add art work to an album. The progress bar pops up and freezes. iTunes though is still responsive. I can pause music. I can select a different track. Yet, the progress bar still is shown. I've been using iTunes for years and I know this isn't possible. It won't let me CMD+Q quit the app. But if I right click in the dock and choose Quit (not force quit) the app quits fine. I can then reopen it like normal.
    Let's say I go back to the album that I was adding cover art too. Half of the songs will have the cover art, the other half not. I then have to add the art one by one or I'll get that same progress bar error. This is very annoying, since I'm building my library all over again. I have to quit and re open the app multiple times. Frustrating!
    I've tried a new new Library file, I tried re-installing iTunes. Same thing happens. Should I just delete the entire iTunes folder in /Library? Will that fix it?

    Boot from your System install disc and run Disk First Aid and Repair permissions.

Maybe you are looking for