[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

repainting issue

Posted on 2002-05-06
9
Medium Priority
?
236 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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
 
LVL 16

Accepted Solution

by:
heyhey_ earned 300 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

656 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