public void run() { while (true) { if (!isFirst) { room.physic(); } repaint(); try { Thread.sleep(1); } catch (Exception e) { } } }