Auto-scroll when creating logs

This commit is contained in:
4pr0n 2014-03-08 11:27:30 -08:00
parent 3deddf3af6
commit 55e58b542d

View File

@ -24,6 +24,7 @@ import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.border.EmptyBorder;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultCaret;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
@ -139,7 +140,9 @@ public class MainWindow implements Runnable {
logPanel.setVisible(false);
logPanel.setPreferredSize(new Dimension(300, 300));
logPanel.add(logTextScroll, gbc);
DefaultCaret caret = (DefaultCaret) logText.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
historyPanel = new JPanel(new GridBagLayout());
historyPanel.setBorder(emptyBorder);
historyList = new JList();