X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAnnotationRowFilter.java;h=c96dbabf1094f87d9618ce0120dd223899da9364;hb=c956ba7ae40dd7f269aa372044ed4ed5f28fb042;hp=f1b97eb6ef83c488e29cc6ea0244160259b68999;hpb=6d6c9b65d01adbdd8b624bea6a766165e4497bb6;p=jalview.git diff --git a/src/jalview/appletgui/AnnotationRowFilter.java b/src/jalview/appletgui/AnnotationRowFilter.java index f1b97eb..c96dbab 100644 --- a/src/jalview/appletgui/AnnotationRowFilter.java +++ b/src/jalview/appletgui/AnnotationRowFilter.java @@ -31,7 +31,6 @@ import java.awt.Panel; import java.awt.Scrollbar; import java.awt.TextField; import java.awt.event.ActionEvent; -import java.util.Vector; @SuppressWarnings("serial") public abstract class AnnotationRowFilter extends Panel @@ -115,7 +114,7 @@ public abstract class AnnotationRowFilter extends Panel public void cancel_actionPerformed(ActionEvent e) { reset(); - ap.paintAlignment(true); + ap.paintAlignment(true, true); frame.setVisible(false); } @@ -134,23 +133,28 @@ public abstract class AnnotationRowFilter extends Panel updateView(); } + /** + * update the text field from the threshold slider. preserves state of + * 'adjusting' so safe to call in init. + */ protected void setThresholdValueText() { + boolean oldadj = adjusting; adjusting = true; if (percentThreshold.getState()) { double scl = slider.getMaximum() - slider.getMinimum(); scl = (slider.getValue() - slider.getMinimum()) / scl; - thresholdValue.setText(100 * scl + ""); + thresholdValue.setText(100f * scl + ""); } else { thresholdValue.setText((slider.getValue() / 1000f) + ""); } thresholdValue.setCaretPosition(0); - adjusting = false; + adjusting = oldadj; } - + public void thresholdValue_actionPerformed(ActionEvent e) { try @@ -158,15 +162,16 @@ public abstract class AnnotationRowFilter extends Panel float f = Float.parseFloat(thresholdValue.getText()); if (percentThreshold.getState()) { - slider.setValue(slider.getMinimum() - + ((int) ((f / 100f) * (slider.getMaximum() - slider - .getMinimum())))); + int pos = slider.getMinimum() + + (int) ((slider.getMaximum() - slider.getMinimum()) * f + / 100f); + slider.setValue(pos); } else { slider.setValue((int) (f * 1000)); } - updateView(); + valueChanged(false); } catch (NumberFormatException ex) { }