I'm observing a very strange problem.
- a DrawingBoard class that implements JPanel - an abstract Element class that implements a JPanel that is added to the DrawingBoard
- classes which implement the Element class for example Res class
Each element should have an image. When I load the image in the constructor of "Res", it does not get drawn until another element is added (next paint event).
I stepped through it; the paintComponent event does fire but the image size upon the first paint is -1 (but the image is NOT null).
Then I tried loading the images in the abstract Element class, and the problem does not occur except for the first time. so I still need to fix it because the first time also matters and also I prefer to load the image in the child class which has it's own properties such as size.
Does anyone have any idea why this is happening?