This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm very very new to Java and I'm trying to make a simple graphics program but the thing is, everytime I resize or minimize the window, the graphics change.
I know that if I setVisible/minimize/resize the window, paint method is called and graphics are redrawn. How do I avoid that?
Alex Nito wrote:Sorry, I wasn't too clear. I mean, how should I modify my program to avoid the redraw?
I want to redraw only when I press the button and keep the graphics intact when I resize the window.
This makes me a little bit fearful. Are you changing a state of your program or your graphics every time it is redrawn? In other words do you have any program logic in your graphics (paint or paintComponent) method? If so, we need to talk.