I'm trying to get JTextArea in a JSCrollPane to display the latest text
after I use append. Whatever I do it seems to scroll up to the top of the
area, which isn't very useful. Thanks in advance for any help.
The code I've got (very much cut down of course is:
JTextArea textArea = new JTextArea();
JScrollPane scrollPane = new JScrollPane(textArea);
.
.
.
textArea.append("various bits of data\n");
scrollPane.scrollRectToVisible(new Rectangle(0,textArea.getHeight
()-scrollPane.getHeight(),
scrollPane.getWidth(),scrollPane.getHeight()));
scrollPane.validate();
Peter