1 16 package org.apache.log4j.lf5.viewer; 17 18 import java.awt.*; 19 import java.awt.event.AdjustmentEvent ; 20 import java.awt.event.AdjustmentListener ; 21 22 33 34 36 public class TrackingAdjustmentListener implements AdjustmentListener { 37 41 45 protected int _lastMaximum = -1; 46 47 51 55 59 public void adjustmentValueChanged(AdjustmentEvent e) { 60 Adjustable bar = e.getAdjustable(); 61 int currentMaximum = bar.getMaximum(); 62 if (bar.getMaximum() == _lastMaximum) { 63 return; } 65 int bottom = bar.getValue() + bar.getVisibleAmount(); 66 67 if (bottom + bar.getUnitIncrement() >= _lastMaximum) { 68 bar.setValue(bar.getMaximum()); } 70 _lastMaximum = currentMaximum; 71 } 72 73 77 81 } 85 86 | Popular Tags |