Link to home
Start Free TrialLog in
Avatar of wyldsj
wyldsj

asked on

how to force repaint()?

Hi,

  My code has the following structure:

for(int i = 0; i < 10000; i++) {
  do some calculation;
  drawCanvas.repaint();
}

What I want is to do some calculation and plot the progress, and so on. But it seems that only after the loop is finished, the my "drawCanvas" is repainted(WM_PAINT message is blocked). May I know how to force painting? In MFC, we can use GetClientDC() to obtain a graphic device to draw on. Is there anything similar in Java? By the way, I need this to be done with JDK1.0.2 for maximum compatibility.
Thanks for your time.

wyldsj
ASKER CERTIFIED SOLUTION
Avatar of gadio
gadio

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wyldsj
wyldsj

ASKER

gadio: you are right. My loop is within an event handler. It actually occurs after a button is clicked. But I cannot figure out a different structure... Is there any suggestions from you?

wyldsj
Avatar of wyldsj

ASKER

Hi! I just figured it out myself and it worked now! Thanks for your help, gadio!

wyldsj