Scroll to bottom

This commit is contained in:
Lucas Alber
2019-02-27 15:39:38 +01:00
parent 60f95bd734
commit 20dc9d3d25

View File

@@ -10,6 +10,7 @@ import java.util.stream.Collectors;
import javax.swing.*;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
import javax.swing.text.DefaultCaret;
import javaxt.io.Image;
/**
@@ -35,6 +36,8 @@ public class Main {
final JTextArea textArea = new JTextArea(16, 58);
textArea.setEditable(false);
DefaultCaret caret = (DefaultCaret) textArea.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
JScrollPane scroll = new JScrollPane(textArea);
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);