How to slow things down to see the progress bar?

how to slow things down to let the progress bar to show its progress?
everytime i run the program i can see only two scenario: 1. 0% 2. 100%
i think the stuffs are too little to make any difference.
what should i add in the codes so that i can see the progress?
thanks!
here is my codes:
jProgressBar1.setValue(1);
do some stuff here
jProgressBar1.setValue(15);
do some stuff
jProgressBar1.setValue(31);
do some stuff
jProgressBar1.setValue(41);
do some stuff
jProgressBar1.setValue(61);
do some stuff
jProgressBar1.setValue(100);

Hi!
When you call update on the progress bar, the value of the progress bar is updated, but it won't be reflected on the screen until Swing has a chance to repaint. Swing can't repaint until your code is finished. So, what's happening is something like this:
setValue(1), do stuff, setValue(15), do stuff, setValue(31), do stuff, Swing Repaint
Also, not only does this block the progress bar from updating, but as long as your code here is running it blocks all of Swing (repainting, handling events, etc...).
If your "stuff" isn't very time consuming, just remove the progress bar altogether. Otherwise, to make things work properly, you'll want to move it to another thread. Then, from that thread you can keep the progress bar up to date with:
SwingUtilities.invokeLater(new Runnable() {
    public void run() {
        jProgressBar1.setValue(xxx);
});Hope that helps!
Shannon Hickey (Swing Team)

Similar Messages

  • Why I cannot see the progress bar whenever I download my apps directly from my App Store ?

    Whenever I install an app, I cannot see the app's icon on the home screen and then when I proceed into the home page, the apps will not be installed unless I stay into the App Store and wait till the circle on the top of the screen stop turning. It is really very inconvenient. I'm using iPhone 4S. Anyone knows the solution? And I'm can't see the progress bar showing whether its downloading. I'm using IOS 6. And I've got another issue. Why whenever I want to reinstall the youtube they would say its free. When I press the 'free' it will go into the 'install' and then when I press the 'install', it would go back to 'free' and because of that I'm unable to download youtube. It's only youtube I'm able to install other apps. But ya, I cannot see the progress bar. Help anyone?

    Actually, the app is there, and it asks to PAY AGAIN, that was the issue, but I have just solved the problem using your first advice, as I tried a few times with different names in my account.
    For example, you told me to use the same ID...
    I have a ONE account, but sometimes I sign in as [email protected] and sometimes I sign in as [email protected] and sometimes I sign in as [email protected] and that made all the difference, as I tried them all and finally with [email protected] worked and gave me the opportunity to download again.
    Thanks a lot for the tip.
    Luiz

  • Computer shuts down while loading the progress-bar

    SPECS:
    MacBookPro 13-inch
    Early-2011
    I recently installed Yosemite in my computer, hours later while I was using the new OS X my computer freezed. I held the power button and it turned off. Now, I'm trying to power on the computer and when the progress bar is in 50% the computer turns off.
    I need help ASAP

    rthec wrote:
    I've seen some of the threads regarding this but none of the fixes work for me.  I formatted my hard drive for reasons other than this so it has a fresh install of Windows XP Home Edition, the latest video drivers, and the latest Flash.  When my wife plays Cityville or Castleville, her computer shuts down.  I checked the system logs and nothing is there regarding the shutdown.  I tried changing the hardware exiliration setting and that didn't help.  We've tried the games on Firefox and IE 8 with the latest updates and it still doesn't work.  Any help will be appriciated.
    The operating system, XP in this particular case, will shutdown the system to prevent damage to hardware if it encounters an instruction which can damage the system. It will usually logs an event which you can view by clicking Start, then in the Run field, type eventvwr.msc and click OK. Then open the both the "System" and "Application" submenus and look for events which are prefixed with a white X inside a red circle. The 6th column from the left will contain the Event ID which can be used to try and track down the source of the problem.

  • How do I get Explorer to see the Navigation Bar on a site published to a CD

    I built a site in iWeb and published it to a Folder on my desktop then burned the folder to a CD. It works fine in Safari but Explorer can't see the top line (the Navigation Bar) so it is useless to anyone with a PC that doesn't have Safari installed. Is there a solution?

    Thanks Ethanoid, that did it. Something peculiar is happening though, Here is what the Home page looks like in iWeb:
    http://idisk.me.com/f_thorgrimsson-Public/Picture 2.png/
    and here is what it looks like if I "visit" from iWeb:
    http://idisk.me.com/f_thorgrimsson-Public/Picture 3.png/
    and this is what I see when I vist from the folder by opening index.html
    http://idisk.me.com/f_thorgrimsson-Public/Picture 4.png/
    ?????

  • I can't get my cursor to completely leave the screen, so when I'm watching videos on some services the video control menu stays at the bottom of the screen. How do I make it disappear so I don't have to see the progress bar and stop/start buttons?

    When I watch certain video services like amazon or Netflix and enter full screen, when I move the cursor a video menu pops up on the bottom of the screen and won't disappear until the cursor goes offscreen. But my cursor won't go fully off screen. Just the tip remains visible so the video menu doesn't leave.

    What happens if you simply click the trackpad in the movie area before the cursor disappears?  Does that cause the video menu to disappear?

  • 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.

  • I've down loaded adobe flash player but when I try to veiw video on firefox I'm still told that I need adobe flash player. How do I get firefox to see the flash player download?

    I was trying to view a video I uploaded to facebook using firefox. The system told me to down load adobe flash player. I did but still get the message that I need to down load flash player. How do I get firefox to see the down loaded adobe flash player?

    by installing from within Firefox, Internet Explorer has its own version (Active-X).
    Make sure you are starting in the correct place for Flash
    * http://www.adobe.com/software/flash/about/
    If you want to read PDF files in you browser, you might also want
    * http://get.adobe.com/reader/
    After the download,
    #bring up the download manager ("Ctrl+J") and start your installs. As soon as the install comes up,
    #close Firefox with '''File > Exit''' or "Firefox" button > Exit. Give Firefox some time to close.
    #If install does not proceed, '''terminate "firefox.exe"''' and '''"plugin-container.exe"''' from the "Processes" tab in the Windows Task Manager.
    #* Windows 7 shortcut to the WTM is "Ctrl+Shift+Esc"
    #* or on any Windows system from "Ctrl+Shift+Esc" then choose Windows Task Manager.
    #*Make sure that "firefox.exe" is no longer running -- if it is still running then terminate it by selecting the use "End Process" button or from context menu, and do the same for "plugin-container.exe" if it is found there.
    #proceed with the install.
    '''Warning''': this is the Adobe site and they have chosen to to provide crapware along with their own product. Only install the product you were planning to install. Do not install additional products: including -- "Free! McAfee Security Scan Plus" or "Google Chrome". Installing Google Chrome on your own and installing it because it is offered on the Adobe site are two different things.
    Find updates for your installed plugins at http://www.mozilla.com/plugincheck/ mozilla.com/plugincheck
    -- best to use Adobe's site to really see if their plug-ins are up to date.
    Please fix your caps lock or read what you type, do you think anybody could read my answer if I typed in all caps.
    If the above fails to correct the problem, I would try uninstalling Adobe Flash from your system entirely first, from the control panel then "Programs and Features".

  • 2nd Display: does it slow things down?

    This could be a really stupid question, so bear with me -- does the addition of a second screen to the imac duo slow the machine down? I have noticed that Aperture isn't quite as zippy, and I suspect it's a simple lack of VRAM because of the other monitor...
    True?

    All other things being equal, and the VRAM already being higly used, it seems perfectly logical that adding a secondary display would slow things down. Extra trips to main memory to fetch things that don't fit into VRAM do take time. No idea how noticeable this performance hit would be though/how much load would be required to make it noticeable.

  • Preloader - slowing things down?

    Hello there - hope you're good - thanks for looking at this.
    I've been experimenting with 2 different kinds of preloaders,
    they both work (internal & external preloaders), both giving
    the same kinda results... but both slowing things down a bit.
    Let me explain!
    I have 2 swfs, each one about 500k, with some streaming audio
    embedded in the timeline, and banks of buttons that hop around the
    timeline to play different sounds.
    In a sec i'll post a link to an example page, but let me
    explain first what you'll be looking for the first time they load.
    The swf on the left (just under the VOICE title) has a
    preloader built into the beginning of the movie, which i made
    thanks to Lee's "Advanced Flash Preloader" tutorial. I've made sure
    there's no data on the first 2 frames (where the preloader is) so
    it should load quick. The preloader graphic is just a bar that
    fills from left to right.
    The swf on the right (just under the MUSIC title) is an
    external preloader called MUSIC2.swf, that preloads MUSIC.swf. This
    was made using Lee's "External SWF Preloading" tutorial. The
    preloader graphic for this is just a percentage.
    With both of them there's still a delay before even showing
    the preloader - and then i reckon the actual preloading process is
    slowing things down. When i tried other versions of the swf's that
    just opened normally, they seemed to load much quicker.
    At the moment i'm thinking that the issue of the preloading
    graphic not showing straight away is an actual fixable problem, but
    the issue of the preloading graphic slowing the preloading is
    probably just the way it is?
    Anyway, here's the link...
    http://keepholding.com/examplesinner2.htm
    (ignore the fact the functionality of the audio buttons on
    the panel on the left is a bit screwey - i haven't fixed that since
    i shifted everything along by 2 frames to make the preloader!).
    Now my mum has a slow dial-up connection, and she didn't even
    get to see either of the preloaders, before she had to go to bed!
    Thinking about it, there are some small solo audio swf
    buttons further down the page - so may the browser will try and
    load those first - even though they're only tiny - maybe THAT is
    the problem?!
    Oh by the way, the reason i've used 2 different types of
    preloaders is just for experimentation. I plan to use the best one
    on both when it's proven to work properly.
    Some of the files i've used are in this zip file
    http://keepholding.com/bits.zip
    VOICEUNITv2 is the raw FLA file used to make VOICES3.swf
    MUSICLOADER is the raw FLA file used to make preloader
    MUSIC2.swf, which preloads MUSIC.swf.
    Does any of this make sense?
    Can you help?!
    cheers
    James

    Oh, when i say Lee's tutorial, i mean from
    www.gotoandlearn.com

  • How do you shut down apps on the 5s?

    How do you shut down apps on the 5s?

    Been asked a thousand times in the past two days... look to your right under "More Like This" for related discussions.   ------->
    Or, take a look at the User Guide

  • In Firefox 4, how do I get back the context menu for the drop down list of the Location Bar so I can Open Link in New Tab, which I did often in FF 3?

    Firefox 3 has a context menu for the drop down list of
    the Location Bar. One option on this menu I used often
    is "Open Link in New Tab" -- quite convenient.
    This context menu has disappeared in Firefox 4.
    Can I get it back?

    See also:
    *Tools > Options > Privacy > History: "Remember search and form history"
    *https://support.mozilla.org/kb/Form+autocomplete
    The "Use custom settings for history" setting allows to see the current history and cookie settings, but selecting that setting doesn't make any changes to history and cookie settings.<br />
    Firefox shows the "Use custom settings for history" setting as an indication that at least one of the history and cookie settings is not the default to make you aware that changes were made.<br />
    If all History settings are default then the custom settings are hidden and you see "Firefox will: (Never) Remember History".<br />

  • My iMac does not see the new Toshiba external drive in Finder or Disk Utility.  How can I get it to see the drive?

    My iMac does not see the new Toshiba external drive in Finder or Disk Utility.  How can I get it to see the drive?

    From the menu bar, select
               ▹ System Preferences ▹ Energy Saver ▹ Power Adapter  
    and uncheck the box labeled Put the hard disk(s) to sleep when possible, if it's checked.
    If the drive has more than one interface (USB, FireWire, Thunderbolt, eSATA), try one of the other interfaces.
    Check that the data cable is securely inserted at both ends.
    Try a different cable.
    If you're connecting the drive through a hub, connect it directly to a built-in port on the Mac.
    If you're connecting it directly, try a different port.
    Disconnect all other devices on the bus, or as many as possible.
    Test the drive with another Mac. Test another drive with this Mac.
    If the drive is bus-powered, but has an AC adapter, connect the adapter.
    Start up in Recovery mode and launch Disk Utility. Is the drive recognized?
    Start up in Safe Mode and test.
    Reset the NVRAM.
    Reset the System Management Controller.
    If the drive doesn't work under any of the above conditions, and if another drive does work with the same Mac, then the drive is malfunctioning.

  • Can't see the Menu bar in iTunes. How do I access it?

    iMac, 10.10.1, 32gb
    can't see the Menu bar in iTunes. How do I access it? I need to authorize this computer but following the directions does not help.

    Authorize your computer using iTunes - Apple Support

  • How can I get iPhoto to see the edited iPhone 4s photo?

    I have a new iPhone 4s.  I take a picture. I edit it and save it to the iPhone.  Then, I sync my phone with my Mac, open iPhoto.  Only the original photos appear, not the one I edited and saved.  Yet, if I e-mail the photo to myself, I can see the edited version.  So, how do I get iPhoto to see the edited version.

    8 MP is the resolution of the camera sensor.  Images are compressed when stored so quite a bit smaller.  The compression ratio depends on the level of detail in the image.

  • How can i see the progress of import?

    Hi.
    Does anyone happen to know how you can see the progress of file import on FCPX?
    I was importing from my camera and after a while thought FCPX was done, so i tried to eject the cam. Then FCPX prompted me that it was still busy importing.
    Is there a way to see progress bars or something similar?
    thanx

    Press Cmd-9 for the background process HUD, click here.
    This should be pretty darn quick, but without knowing what camera and format you're talking about it's hard to tell.

Maybe you are looking for

  • Varinat configuration copy of batch characteristics from Sale order to production batch

    hi experts , below is the scenario : the characteristics and its value which are maintained in the sale order must be copied to batch produced during process order GR . it was not available in 4.7 but availbale in ECC 6.0 i guess by SAP. i have creat

  • SAP inbound and outbound delivey in single shipment document

    Hi We are doing outbound and inbound delivery creation in SAP. These are dropped to OTM(oracle transport management system). OTM will create orders for deliveries and groups multiple deliveries into one shipment. This is sent back to SAP for shipment

  • How to upload and search a document in KM

    Hi Experts, we are beginners in SAP EP.....can u guys provide me inputs for the follwing queries..... How to upload a document in KM ? How to search a document in KM? How to disable the windows authentication for protals? if it is enabled u can able

  • PC Card for MacBook

    Hi, i have a PC Card (wireless 3G CDMA) I use with my laptop PC and I would like to use it in with a MacBook that lacks the PC Card slot. Is this possible via an USB adapter or so? Thanks.... /Mans

  • Cannot change date format in delimited output

    Hi, I am launching a series of Reports from a Forms environment in pdf format without any problem. However, we're finding trouble when setting the format to excel (desformat=delimiteddata in set_report_object_property). Date fields which include hour