I tried making a Java desktop application to learn Java. So far, a mouse click event draws rectangles in the document and stores the rectangle in an array in ProjectApp.java. This isn't the problem but my rectangles disappear when I minimize and maximize the window. I normally use VS C++ by looping through an array in the doc class and return the rectangle each time and then drawing when OnDraw is called.
So, what's the OnDraw equivalent in a Java desktop application? Is this even possible? I have tried googling this. Making my own paint(Graphics g) method with the super.paint(g) doesn't work.