• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Update progress of a process in Progress bar - SWT Java GUI

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my Java SWT application, I have few methods, that take longer time to complete. These methods has to be initiate and run as response to button click. There I want to implement progress bar to show the progress/status of long run method. Long run methods are Java Processes, in which it executes some command line functionality. (ex: run ls method in Linux).



In progress bar status is set using setSelection method which takes int as argument. How to indicate the progress of process in progress bar, because I don't have int value to pass into setSelection method of progressbar.

Hope my question is clear
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you familiar with the relevant Java Tutorials section?
 
indeewari akarawita
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, That is SWING, My program running SWT. Is it fine to use swing progress bar withing SWT program?

 
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

indeewari akarawita wrote:Long run methods are Java Processes, in which it executes some command line functionality. (ex: run ls method in Linux).



In progress bar status is set using setSelection method which takes int as argument. How to indicate the progress of process in progress bar, because I don't have int value to pass into setSelection method of progressbar.



Unless the Linux process itself provides some indication of 'progress' by writing to stdout or stderr there is no way to get a measure of progress to display. This applies whether one uses SWT, Swing or just Java System.out to do the display.
 
Bartender
Posts: 5465
212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe: if you know how long such a process takes, then you could set up a timer
and give an estimate of the progress yourself. That is, if that is possible in SWT.

Greetz,
Piet
 
indeewari akarawita
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have idea how long will it take. Does this mean there is no way of doing progress bar
 
Rancher
Posts: 43081
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's what an indefinite progress indicator is for.
reply
    Bookmark Topic Watch Topic
  • New Topic