void () { SwingUtilities.invokeLater(() -> { if (myLog.getDocument().getLength() == 0) return; Rectangle bounds = myLog.getBounds(); myLog.scrollRectToVisible(new Rectangle(0, (int)bounds.getMaxY() - 1, (int)bounds.getWidth(), 1)); }); }