• 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

JFrame monitor of a calculation

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Who can tell me how the progress of a certain calculation can be shown in a JFrame?
I've made a JFrame, complete with a Panel & GridBag layout. Then the program begins a calculation (say, int x runs from 0 to 1,000,000 by means of a x++ loop).
On GridBag location [0,0] lives a JLabel that says "x = ".
Now I would like to see on location [0,1] my dapper int x grow ever larger until x = 1,000,000.
How should I go about that?
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Swing doesn't do well with this; it would take a lot of work. If you have a long-running task and need to keep the user apprised of the progress you can use a JProgressBar.

Usually, updates come as a result of, or in response to user interaction. The app below shows this.
 
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic