Hi,
I have a custom Form and I want to load an Image, edit it and show it. It looks like this:
public class MyForm extends Form{
private Image img;
private boolean ready;
public MyForm(){
ready = false;
new Thread(new Runnable() {
// load img and edit it
ready = true;
}).start();
}
public void paint(Graphics g){
if (ready){
//draw img
}else{
//draw "loading"
}
}
}
This actually works fine and looks good for me, but I get an EDT-violation.
I also get the EDT-violation when using Display.getInstance().startThread(...).start();
When using Display.getInstance().callSerially(...); or Display.getInstance().callSeriallyAndWait(...); I don't get the EDT-violation.
When editing the Image, I call img.getRGB(), which seems to lead to the violation.
Is it a false alarm? (getRGB leads to EDT-violation when not running on the EDT ?)
Which method should I use for loading and editing the Image?
Is there a difference between new Thread(r).start(); and Display.getInstance().startThread(r, "name").start(); ?
Best regards, Matthias