Originally Posted by Fou-Lu
sc = wi.getScaledInstance(puzpiece.getWidth()/3,puzpiece.getHeight()/3, Image.SCALE_AREA_AVERAGING);. The problem itself is quite simple: the Panel does not yet have a size since the frame has not been packed and is not yet visible.
I'm not sure what the best way to do this would be, but what would probably work is to hook an ancestor listener into the panel. This way it'll trigger an ancestorMoved event immediately upon displaying the frame. You should then be able to do what you want to do with the images, and then repaint the panel again.
Yeah that should work methinks.
Oh thanks for the tip.
Will try my best to see how to implement AncestorListener..
I found another method Link
which is related to overriding the getPreferredSize() method , but it is equally hard to implement lol.