# Using JProgressBar?

**URL:** <https://forum.servoy.com/t/using-jprogressbar/11354>\
**Category:** Classic Servoy\
**Created:** [November 2, 2009, 12:33pm UTC](https://forum.servoy.com/t/using-jprogressbar/11354 "2009-11-02T12:33:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kahuna](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@Kahuna](https://forum.servoy.com/u/Kahuna)\
**Post date:** [November 2, 2009, 12:33pm UTC](https://forum.servoy.com/t/using-jprogressbar/11354/1 "2009-11-02T12:33:21Z")

</div>

I anticipated that a JProgressBar set to indeterminate would continue to scroll when placed on a form that then goes into a long process.

I hide the bar onLoad, show it when a process starts , and it then starts to scroll but almost immediately stops for the remainder of the process?

Should I be displaying this progress bar in a dialog on top of this ‘working’ form or did I miss something in order to make it work?

Using application.updateUI() in my loop massively slows the process.

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [November 2, 2009, 12:46pm UTC](https://forum.servoy.com/t/using-jprogressbar/11354/2 "2009-11-02T12:46:58Z")

</div>

I guess application.updateUI() is necessary. Without that, the GUI and your progress bar will not be updated. You could do that every x times of an iteration only to not slow down your process too much.

---

<div class="post-metadata">

**Author:** ![Kahuna](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@Kahuna](https://forum.servoy.com/u/Kahuna)\
**Post date:** [November 2, 2009, 1:02pm UTC](https://forum.servoy.com/t/using-jprogressbar/11354/3 "2009-11-02T13:02:14Z")

</div>

> patrick:  
> I guess application.updateUI() is necessary. Without that, the GUI and your progress bar will not be updated. You could do that every x times of an iteration only to not slow down your process too much.

Thanks Patrick - yes it looks like using it on say every 5th loop might be the answer.

In the past I think I’ve used a MOD() function but I cant see anything similar in Servoy - or something that will take the loop index and divide by 5, and be true if the result is an integer and not if its a decimal.

Any pointer from your experience Patrick?

---

<div class="post-metadata">

**Author:** ![ROCLASI](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/roclasi/32/4371_2.png) [@ROCLASI](https://forum.servoy.com/u/ROCLASI)\
**Post date:** [November 2, 2009, 1:06pm UTC](https://forum.servoy.com/t/using-jprogressbar/11354/4 "2009-11-02T13:06:37Z")

</div>

Hi Ian,

You can use the following code:

```auto
if ( i%5 == 0 ) {
    // update on every 5th item
    application.updateUI();
}

```

Which is the JS equivalent of your MOD() function.

---

<div class="post-metadata">

**Author:** ![Kahuna](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@Kahuna](https://forum.servoy.com/u/Kahuna)\
**Post date:** [November 2, 2009, 1:11pm UTC](https://forum.servoy.com/t/using-jprogressbar/11354/5 "2009-11-02T13:11:16Z")

</div>

> ROCLASI:  
> Hi Ian,
> 
> You can use the following code:
> 
> ```auto
> if ( i%5 == 0 ) {
> 
> ```

```
// update on every 5th item
application.updateUI();

```

}

> ```auto
> 
> Which is the JS equivalent of your MOD() function.
> 
> ```

Very lovely thanks Robert! Just what I needed - and using every 5th loop extended the process time by only 10 seconds total which is acceptable - and I noticed any longer and the progress bar movement is too sluggish to be attractive - so looks like 5 is the magic number in this instance.

Thanks Robert and Patrick again.

---

<div class="post-metadata">

**Author:** ![victor.rojo](https://avatars.discourse-cdn.com/v4/letter/v/57b2e6/32.png) [@victor.rojo](https://forum.servoy.com/u/victor.rojo)\
**Post date:** [July 14, 2010, 1:36pm UTC](https://forum.servoy.com/t/using-jprogressbar/11354/6 "2010-07-14T13:36:50Z")

</div>

> patrick:  
> I guess application.updateUI() is necessary. Without that, the GUI and your progress bar will not be updated. You could do that every x times of an iteration only to not slow down your process too much.

So the progress bar only will be updated in Smart Client, isn´t?  
Any trick for use it in Web Client?

Thanks

---

<div class="post-metadata">

**Author:** ![ROCLASI](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/roclasi/32/4371_2.png) [@ROCLASI](https://forum.servoy.com/u/ROCLASI)\
**Post date:** [July 14, 2010, 2:00pm UTC](https://forum.servoy.com/t/using-jprogressbar/11354/7 "2010-07-14T14:00:05Z")

</div>

Hi Victor,

The JProgressbar bean is not web enabled so you can’t use it in Webclient. I guess you can create your own progressbar using HTML and a global field that you update every x times.

---

<div class="post-metadata">

**Author:** ![victor.rojo](https://avatars.discourse-cdn.com/v4/letter/v/57b2e6/32.png) [@victor.rojo](https://forum.servoy.com/u/victor.rojo)\
**Post date:** [July 15, 2010, 8:39am UTC](https://forum.servoy.com/t/using-jprogressbar/11354/8 "2010-07-15T08:39:14Z")

</div>

Hi Robert,

thanks for your tip. I think that I’m going to use an animated gif with a status text so I have the same code in WC and SM.
