Class ScrollCorrector

  • All Implemented Interfaces:
    java.awt.event.AdjustmentListener, java.util.EventListener

    public class ScrollCorrector
    extends java.lang.Object
    implements java.awt.event.AdjustmentListener
    Corrects a strange behaviour with JScrollPane when lines are appended from another thread. Moves the vertical slider to the last position.

    usage: add as an adjustment listener to the VerticalScrollBar, eg., scrollPane.getVerticalScrollBar().addAdjustmentListener(new ScrollCorrector());

    Taken as a modified version from traiton , on Sun's bug parade. See: JTextArea's don't automatically scoll when appending() to them. 20 February 2001 entry.

    Modified as needed.

    Author:
    traiton
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean atLastPos
      DOCUMENT ME!
      private int lastMax
      DOCUMENT ME!
    • Constructor Summary

      Constructors 
      Constructor Description
      ScrollCorrector()
      Does nothing.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void adjustmentValueChanged​(java.awt.event.AdjustmentEvent ae)
      DOCUMENT ME!
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • atLastPos

        private boolean atLastPos
        DOCUMENT ME!
      • lastMax

        private int lastMax
        DOCUMENT ME!
    • Constructor Detail

      • ScrollCorrector

        public ScrollCorrector()
        Does nothing.
    • Method Detail

      • adjustmentValueChanged

        public void adjustmentValueChanged​(java.awt.event.AdjustmentEvent ae)
        DOCUMENT ME!
        Specified by:
        adjustmentValueChanged in interface java.awt.event.AdjustmentListener
        Parameters:
        ae - DOCUMENT ME!