--- /dev/null
+package jalview.gui;\r
+\r
+import jalview.jbgui.*;\r
+import jalview.datamodel.*;\r
+import jalview.schemes.*;\r
+import java.awt.event.*;\r
+import javax.swing.event.*;\r
+\r
+public class SliderPanel extends GSliderPanel\r
+{\r
+ AlignmentPanel ap;\r
+ boolean forConservation = true;\r
+ ColourSchemeI cs;\r
+\r
+ public SliderPanel(AlignmentPanel ap, int value, boolean forConserve, ColourSchemeI cs)\r
+ {\r
+ this.ap = ap;\r
+ this.cs = cs;\r
+ forConservation = forConserve;\r
+ if(forConservation)\r
+ {\r
+ label.setText("Enter the value by which to decrease conservation colour intensity");\r
+ slider.setMinimum(0);\r
+ slider.setMaximum(50);\r
+ }\r
+ else\r
+ {\r
+ label.setText("Enter the percent identity above which to colour residues");\r
+ slider.setMinimum(0);\r
+ slider.setMaximum(100);\r
+ }\r
+\r
+\r
+\r
+ slider.addChangeListener( new ChangeListener()\r
+ {\r
+ public void stateChanged(ChangeEvent evt)\r
+ {\r
+ valueField.setText( slider.getValue()+"" );\r
+ valueChanged( slider.getValue() );\r
+ }\r
+ });\r
+\r
+ slider.setValue(value);\r
+ valueField.setText(value+"");\r
+ }\r
+\r
+ public void valueChanged(int i)\r
+ {\r
+\r
+ if(forConservation)\r
+ {\r
+ if (cs instanceof ConservationColourScheme)\r
+ ( (ConservationColourScheme) cs).inc = i;\r
+ }\r
+ else\r
+ {\r
+ if( cs instanceof ResidueColourScheme)\r
+ {\r
+ ResidueColourScheme rcs = (ResidueColourScheme) cs;\r
+ rcs.setThreshold(i);\r
+ }\r
+ else if( cs instanceof ScoreColourScheme)\r
+ {\r
+ ScoreColourScheme scs = (ScoreColourScheme) cs;\r
+ scs.setThreshold(i);\r
+ }\r
+\r
+ }\r
+\r
+ ap.seqPanel.seqCanvas.paintFlag=true;\r
+ ap.seqPanel.repaint();\r
+\r
+ }\r
+\r
+ public void valueField_actionPerformed(ActionEvent e)\r
+ {\r
+ try{\r
+ int i = Integer.parseInt(valueField.getText());\r
+ slider.setValue(i);\r
+ }\r
+ catch(Exception ex)\r
+ {\r
+ valueField.setText( slider.getValue()+"" );\r
+ }\r
+ }\r
+}\r