Solved

repainting issue

Posted on 2002-05-06
9
214 Views
Last Modified: 2010-03-31
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
0
Comment
Question by:aKa
  • 5
  • 4
9 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 6991259
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) ?
0
 

Author Comment

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

0
 
LVL 16

Expert Comment

by:heyhey_
ID: 6993165
> should i start the long task in a separate thread perhaps??

absolutely

0
 

Author Comment

by:aKa
ID: 6998030
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!!
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Accepted Solution

by:
heyhey_ earned 100 total points
ID: 6998267
you can always do something like this


methodXX()
{
   [#1 perform some tasks, declare method variables]
 
  if(error==true)
  {
       popUpDialogbox()
  }

  TaskHandler handler = new TaskHandler();
  handler.val1 = ...;
  handler.val2 = ...;
  handler.start();
}


class TaskHandler extnds Thread
{
  public int val1;
  public String val2;
 
  public void run()
  {  
     // task 2
  }
   
}
0
 

Author Comment

by:aKa
ID: 6998319
right...!

blimey...you got my points!!

0
 

Author Comment

by:aKa
ID: 6998323
but how about passing values from the thread back to the method?
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 6998432
> 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);
 }
}
0
 

Author Comment

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

cheers
thx for the help anyways
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
java. non-English characters encoding problem. intellij idea 3 74
Unable to start eclipse ? 17 132
Java Server Faces parameter pass? 6 39
ForLoop Example 3 40
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now