Skip to main content
broken image fixed (click 'side-by-side' to see the difference; image retrieved via Wayback Machine); for more info, see https://gist.github.com/Glorfindel83/9d954d34385d2ac2597bbe864466259f
Source Link
Glorfindel
  • 22.8k
  • 13
  • 97
  • 124
improved readability
Source Link
OscarRyz
  • 200k
  • 119
  • 399
  • 577

As it is now, your code paints the panel, and until the pause is finish it returns. Visually it would look like just the the paint took too much time to finish, and not as you want to.

What you need to do, is to have a "model" to paint. Your component would just paint that model and returnfinish.

WhatThen you need to do is to add more "things" to your model every second, and that's it.

As it is now, your code paints the panel, and until the pause is finish it returns. Visually it would look like just the paint took too much time to finish, and not as you want to.

What you need to do is to have a "model" to paint. Your component would just paint that model and return.

What you need to do is to add more "things" to your model every second, and that's it.

As it is now, your code paints the panel, and until the pause is finish it returns. Visually it would look like the paint took too much time to finish.

What you need, is to have a "model" to paint. Your component would just paint that model and finish.

Then you add more "things" to your model every second, and that's it.

added 152 characters in body
Source Link
OscarRyz
  • 200k
  • 119
  • 399
  • 577

Short answer

You can use Thread.sleep but not from the paint method. Use it from outside and just reapaint your panel.

Long answer

Short answer

You can use Thread.sleep but not from the paint method. Use it from outside and just reapaint your panel.

Long answer

Source Link
OscarRyz
  • 200k
  • 119
  • 399
  • 577
Loading