java - Filling a rectangle - paint method (MIDP) -


im trying paint rectangle using 2 calls of .fillrect method thread.sleep call between each method. happening sleep method getting called before rectangle initialised, appears rectange has been painted. want paint part of rectange, pause 5 seconds , paint antother part.

here code -

public void paint(graphics g, int w, int h) {     g.drawrect(0, 0, w - 1, h - 1);     g.fillrect(0, 0, 10, h-1);     try {     thread.sleep(5000); } catch (interruptedexception e) {     // todo auto-generated catch block     e.printstacktrace(); }      g.fillrect(0, 0, 50, h-1);  } 

thanks

it bad idea cause event thread block, no matter platform.

what should doing defining variables somewhere store current extent of area want painted. update variables on separate thread (you can block thread want) , call repaint() method schedule repaint whenever update variables.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

sql server - python to mssql encoding problem -

windows - Python Service Installation - "Could not find PythonClass entry" -