void () { while (true) { try { Thread.sleep(myIsBlinkCaret ? mySleepTime : 1000); } catch (InterruptedException e) { } synchronized (this) { if (isStopped) { break; } } if (myEditor == null) { continue; } CaretCursor activeCursor = myEditor.myCaretCursor; long time = System.currentTimeMillis(); time -= activeCursor.myStartTime; if (time > mySleepTime) { boolean toRepaint = true; if (myIsBlinkCaret) { activeCursor.isVisible = !activeCursor.isVisible; } else { toRepaint = !activeCursor.isVisible; activeCursor.isVisible = true; } if (toRepaint) { SwingUtilities.invokeLater(myRepaintRunnable); } } } }