• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

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

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • 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: 65388
248
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
Saloon Keeper
Posts: 3451
149
  • Mark post as helpful
  • send pies
  • 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
  • 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: 43011
76
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's what an indefinite progress indicator is for.
 
a wee bit from the empire
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!