@Override public void actionPerformed(ActionEvent e) { TerminalPanel terminalPanel = ref.get(); if (terminalPanel != null) { terminalPanel.myCursor.changeStateIfNeeded(); if (terminalPanel.needScrollUpdate.getAndSet(false)) { terminalPanel.updateScrolling(); } if (terminalPanel.needRepaint.getAndSet(false)) { try { terminalPanel.doRepaint(); } catch (Exception ex) { LOG.error("Error while terminal panel redraw", ex); } } } else { // terminalPanel was garbage collected Timer timer = (Timer) e.getSource(); timer.removeActionListener(this); timer.stop(); } }
static { caretTimer = new Timer(500, new CaretBlinker()); caretTimer.setInitialDelay(500); caretTimer.start(); }
private void createRepaintTimer() { if (myRepaintTimer != null) { myRepaintTimer.stop(); } myRepaintTimer = new Timer(1000 / myMaxFPS, new WeakRedrawTimer(this)); myRepaintTimer.start(); }