2

I was thinking of doing a commodore 64 style loading screen (with the alternating bars that change colour and grow/shrink in size) and was wondering if anyone has tried this or knows of any code I could look at. I'm gonna make a start on it myself today, but it would be good to have something to compare it against :)

So far, I'm guessing you divide the screen size up and set a constant for the bar height (say 12 horizontal bars for example) and you pick a random number between the constant and constant - 5 or whatever and refresh the screen. It's hard to tell looking at it, but it's something I'd be interested in reproducing.

Desolate Planet
  • 561
  • 5
  • 19

1 Answers1

3

I'd override paintComponent() to draw the horizontal bars. To tile the overlay, you might look at this example that uses getSubimage() to slice the image and javax.swing.Timer to pace the animation.

Addendum: See also this example that does horizontal slices.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045