Originally Posted by Arnold
|
Why don't you put this in the advanced section?
Seriously this is not intended for beginners.
|
Graphics painting itself is a beginners topic, and while a fully fledged paint program is not, this is a simple 'click and draw' program to many of us - I've had to do quite a few of these.
In answer to the OPs question, you'll somehow have to track what pixels are painted on. Your best bet is to track the points the user paints to, and then just redraw the entire 'picture' every time the paintComponent() method is called. I'd suggest an ArrayList<Point> or some other form of list (a Vector? Seems unnecessary as you don't have multi-threading) Make sure that update() looks something like this, or you may have problems...
|
Code:
|
public void update(Graphics g){
super.update(g);
paintComponent(g);
} |
__________________
If the above doesn't make sense to you, ignore it, but remember it - might be useful!
And if you just randomly taught yourself to program, well... you're just like me!