I have a JText area that I want to scroll down as far as possible when I add text if the user has it scrolled down before the text was added.
So far, I have:
boolean needToScroll = false;
JScrollBar vb = scrollPane.getVerticalScrollBar() ;
vb.setMaximum(100);
System.out.println("Maximum : " +vb.getMaximum() + " Current : " + vb.getValue() );
if(vb.getValue() == vb.getMaximum())
{
needToScroll = true;
}
My problem is that is that getValue() returns a number that is always smaller than getMaximum() even when it's scrolled all the way to the bottom.
Any ideas?
Thanks :beer: :thumbsup:
So far, I have:
boolean needToScroll = false;
JScrollBar vb = scrollPane.getVerticalScrollBar() ;
vb.setMaximum(100);
System.out.println("Maximum : " +vb.getMaximum() + " Current : " + vb.getValue() );
if(vb.getValue() == vb.getMaximum())
{
needToScroll = true;
}
My problem is that is that getValue() returns a number that is always smaller than getMaximum() even when it's scrolled all the way to the bottom.
Any ideas?
Thanks :beer: :thumbsup:
