Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

1st question with app  RSS feed

 
carlos sanchez
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I'm diggin' into the search to find a complete answer for this.

I'm building an app with 4 different windows:

1.- Logon Window
2.- Select window.
3.- Data work window.
4.- Bye window.

Actually everyone is an extension of a JFrame, I create and set visible the new window and dispose the old one. Looks good untill I create the Data working window that doesn't display a progress bar (I imagine the task occupies all cpu time and it can't paint the progress bar).

Is this the correct way to structure the window changing. Is there a way to show my progress bar before the method that does the har work starts?
 
Ben Wood
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
carlos,

I think this is because both the 'hard work' bit and the progress bar are both running in the same thread. If you create a new thread to run the hard work processing bit then the GUI (i.e. progress bar) should update itself concurrently...I think
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
carlos sanchez
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, problem is with threads.
I've wallked around using the java tutorial example with using the Progress Monitor dialog box. Just if someone is interested it uses a timer to check the task that's performing the operation and checks it's state.

Just as the one you've sent Craig, thank U.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!