Image Lost on Minimizing Window?

This incorporates the advice of Fredrik and mKorbel, plus a few other tips unrelated to the immediate problem.

This incorporates the advice of Fredrik and mKorbel, plus a few other tips unrelated to the immediate problem. Public class CloseCanvas extends Canvas{ private static final long serialVersionUID = 2L; BufferedImage image = null; CloseCanvas() { try { image = ImageIO. Read(new File("res/close.

Png")); } catch (IOException ex) { ex.printStackTrace(); } setPreferredSize(new Dimension(30,22)); } @Override public void paint(Graphics g) { if (image! =null) { g. DrawImage(image, 0, 0, this); } } }.

– tiger Sep 30 at 12:26 1 Layout managers are more likely to honor the preferred (as well as maximum & minimum) size, than the size, of a component. So short answer: Yes. – Andrew Thompson Sep 30 at 12:44.

I'd suggest you move out the image loading from the paint method. It seems quite static and for every repaint of the Canvas the image will be reloaded which happens many, many times and that will happen on the event dispatch thread.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions