For several weeks, I have been trying to wrap my brain around the concept of the paint(Graphics g) method. I have a pretty good idea how it works, but I am still struggling with the "practical" application of the paint method with respect to OOP.
I can write small apps using paint(Graphics g) to draw/paint rectangles and lines within a JFrame. And I know that its highly desirable to keep all the "drawing" code INSIDE the paint method. I also understand that paint can be invoked by the system or by the application. Where it starts to get hazy is how, in a "real world" application, I would deal with "incremental painting".
Lets say I am writing an app that draws an ellipse somewhere inside a JFrame right when the JFrame opens, then later on, I want to make that ellipse disappear and a few minutes and several user actions later, I want to draw a rectangle, and so on.
If I have put all my "drawing code" inside the overridden paint method, all the graphics get painted at the same time. This is what is screwing with my head. I can't seem to get to a place in my understanding where I get how to do this incremental painting.
Anyone want to take a shot a helping me over this wall?
Thanks,
Tahoe