Campbell Ritchie wrote:Welcome to the Ranch
Please show us what you have got already.
I think your discussion will be moved to a different forum.
Deepak Bala wrote:I am moving this to 'Java in general'.
There are a couple of ways you could do this, starting with the technology in question. Java swing / HTML + JS / Applets etc etc.
What have you done so far ?
Jeanne Boyarsky wrote:What technology are you using? Swing?
Jesper de Jong wrote:No need to post all that code three times. There is an button in the right-hand corner of your post, if you made a mistake you can click that to edit your post. When you use code tags, your code will be nicely formatted to make it more readable on screen.
It looks like you have the basics working already. Can you explain exactly what part you now have a question about?
A small remark about your code: Never "eat" exceptions like you're doing in lines 153 - 155. Always at least print the stack trace inside a catch-block, otherwise you'll never know that an exception occurred:
You are calling Thread.sleep() in the paint() method in line 151. That will probably make your program not respond the the UI. The paint() method is running on Swing's event dispatch thread, and you should not block that thread by making it go to sleep - if you do that, Swing cannot handle other UI tasks to make it respond to the UI. Put the Thread.sleep() and repaint() calls in another thread, not inside the paint() method.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton