I am using 2 classes class1 and class2, in java, both being in different packages. class2 has a paintComponent() and a test() defined in it. I am calling these methods from class1 in the following sequence..
objclass2.repaint()
objclass2.test()
objclass2.repaint()
but I dont know why test() is executed first. repaint() is executed next.. plus the second repaint() is not executed as all.. Why is it so??
EDIT
for(int i=0;i<170;i++)
{
az.animate(i);
try {
Thread.sleep(160);
} catch (InterruptedException ee) {
ee.printStackTrace();
}
}
animate method():-
pd.setCurrentAltitudeScaleValue(val);
azl.update();
azl.repaint();
and in the azl.paintComponent() I am drawing a few things.. The animate method is being called every time the for loop executes but it doesnot call the repaint() again.. means repaint method is called only once though the animate() is called again and again..
I assume you mean that paintComponent() is exhibiting the behaviour you mention. Bear in mind that:
If the design of your program really relies on the order in which paintCompoent() is called, then I would suggest you choose a different design.