Link to home
Start Free TrialLog in
Avatar of aKa
aKa

asked on

repainting issue

I have an applet that pops out a dialogbox. now how can i repaint tha applet when this dialog box is removed. I have so far passed a reference of the applet to the dialogbox and tried to repaint (via {applet}.repaint() ) and then use the update(g) method to paintComponents(g) but it is not working...

even tried repaint(tm) but failed.

Help much appreciated
Avatar of heyhey_
heyhey_

applet is supposed to repaint itself - unless you block the event thread. do you perform any long task immediatelly after closing the dialog box (in the same thread) ?
Avatar of aKa

ASKER

yes...there is a long task after i close the dialog box...should i start the long task in a separate thread perhaps??

> should i start the long task in a separate thread perhaps??

absolutely

Avatar of aKa

ASKER

well that's something that is very difficult for me to implement. This is the program flow:

methodXX()
{
    [#1 perform some tasks, declare method variables]
   
   if(error==true)
   {
        popUpDialogbox()
   }
      [#2 continue task, involves setting and accessing method variables declared above]
}

so now if i include portion #2 in a thread, i can't possibly set any of the values in #1 right? since the run() method of the Runnable class is void, i can't return any value to the method either. Only way is to use static variables??

thanks a bomb for any advice!!
ASKER CERTIFIED SOLUTION
Avatar of heyhey_
heyhey_

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 aKa

ASKER

right...!

blimey...you got my points!!

Avatar of aKa

ASKER

but how about passing values from the thread back to the method?
> but how about passing values from the thread back to the method?

just pass the result handler to the Task Thread

class TaskHandler extnds Thread
{
 public ResultHandler resultHandler;
 public int val1;
 public String val2;

 public void run()
 {
    // task 2
    resultHandler.taskCompleted(result);
 }
}
Avatar of aKa

ASKER

actually...i took an easier route....got the Sun Java Plugin and guess what...no more repainting problems!!!

cheers
thx for the help anyways