JPanel p3 = new JPanel();
p3.setBorder(BorderFactory.createTitledBorder("Classifier output"));
p3.setLayout(new BorderLayout());
final JScrollPane js = new JScrollPane(m_OutText);
p3.add(js, BorderLayout.CENTER);
js.getViewport().addChangeListener(new ChangeListener() {
private int lastHeight;
public void stateChanged(ChangeEvent e) {
JViewport vp = (JViewport)e.getSource();
int h = vp.getViewSize().height;
if (h != lastHeight) { // i.e. an addition not just a user scrolling