List of usage examples for javax.swing JScrollBar removeAdjustmentListener
public void removeAdjustmentListener(AdjustmentListener l)
From source file:savant.view.variation.swing.VariationModule.java
public void visibleRangeChanged(String ref, Range r) { if (r.getLength() > ResolutionSettings.getVariantLowToHighThreshold()) { showMessage(ZOOM_MESSAGE);//from w w w .j a va2s. c o m } else { try { // Detach the adjustment listeners so that setting the maximum doesn't fire an event. for (JScrollBar sb : scrollers) { sb.removeAdjustmentListener(scrollerListener); } for (JScrollBar sb : scrollers) { sb.setMaximum(LocationController.getInstance().getMaxRangeEnd()); sb.setValue(r.getFrom()); sb.setVisibleAmount(r.getLength()); sb.setBlockIncrement(r.getLength()); sb.repaint(); } } finally { // Reattach the adjustment listeners. for (JScrollBar sb : scrollers) { sb.addAdjustmentListener(scrollerListener); } } } rangeField.setText(String.format("%s:%d-%d", ref, r.getFrom(), r.getTo())); }