My project is trying to implement java processing.core.Papplet to display a graphics with different color( Random color changing by times). It is so weird that I can only use:
applet.mousePressed();
to refresh my applet. And I also tried:
applet.redraw();
applet.updatePixels();
applet.loop();
applet.redraw();
applet.noLoop();
applet.redraw();
applet.draw();
But neither of them works in my project. This means I can refresh my Papplet by either Robot mouse click or mouse click to make my applet refresh. Does anybody know what's going on? Appreciate for your great help.
BTW, I have tried the invoke method:
SwingUtilities.invokeLater(new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
target.refresh();
previewController.render(target);
applet.redraw();
}
});
It can force flash the applet, but with some error image. I don't know what's going on with Papplet mousePressed.