Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Minimization then Restoration problem with applets...

 
mo fred
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well.. i created an applet that allows the user to draw lines or rectangles and toggle between the two modes...you can draw rectangles as much as you want.. but when i minimize the applet's window and then restore it ...my drawings are completely lost ..the same problem happens when a window overwrites the applet's window...so can someone help me on how to save the shapes in the graphic context i initially created so that when i restore the applet's window i can find what i previously draw ...??
 
Joe Ess
Bartender
Posts: 9339
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to study up on how to perform custom painting. It sounds like you are painting your components as you draw them, so when the component gets redrawn (after a minimize or overlap), the component is blank. You'll need to save the coordinates of every rectangle and line you create and paint ALL of them every time paint (AWT) or paintComponent (Swing) is called.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic