> The following code is in the actionPerformed when pushing the button:
>
[quoted text clipped - 21 lines]
>
> Thanks for your fast reply
As your code is now, it will do what you want: nextGen() will finish
before paintREAL() is called. If you're not convinced, test this by
printing some output to System.err:
public void nextGen()
{
System.err.println("nextGen starting"); // add this line
// your normal code goes here
System.err.println("nextGen ended"); // add this line
}
public void actionPerformed(ActionEvent e)
{
// normal code
while(run)
{
this.nextGen();
System.err.println("Start painting"); // add this line
// normal code
}
}
For applets under windows you can check this output by right-clicking
the java icon on the tray, and selecting "open console".

Signature
Beware the False Authority Syndrome
oulan bator - 08 Dec 2005 17:21 GMT
something like this should work !
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("Start")){
this.jTextAreaCommandLine.setText(this.jTextAreaCommandLine.getText()+"\nStarted");
//here add it: it launches a new thread to perform your computation and
the refresh
new Thread(new Runnable() {public void run() {
// end
this.run = true;
while (run) {
this.nextGen(); //Updates all the
necessary datas in the
Calculations - THIS have to be finished before going to the next point
jComponentRobotArm1.paintREAL(this.getGraphics()); // This will
//here again
}}).start();
//end 'till there, will be executed
(hopefully) paint the JComponent with the new values - so it have to be
started AFTER this.nextGen() is finished
this.jButtonStartPause.setText("Pause");
}
}
}