vBar is the vertical scrollbar.
Not matter what the current value of the scrollbar is it'll always set the maximum value, which makes absolutely no sense to me. I'm trying to get it so it only scrolls when the scrollbar is already at the end, or its maximum. (so users can view previous data without it jumping around on them when new content is added)
I've done it before using a differenet method involving a JTextPane, but now I'm using an editor pane with a styled document and so I had to come up with this other method for doing autoscrolling.
public void adjustmentValueChanged(AdjustmentEvent e)
{
System.out.println(vBar.getValue()+"/"+(vBar.getMaximum()-vBar.getVisibleAmount()));
if (!e.getValueIsAdjusting())
if (vBar.getValue() == (vBar.getMaximum()-vBar.getVisibleAmount()))
{
vBar.setValue(vBar.getMaximum());
}
}