import java.awt.event.ActionListener;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
static Frame PIDSlider;
public static int setConservationSlider(AlignmentPanel ap,
- CollectionColourSchemeI collectionColourSchemeI, String source)
+ CollectionColourSchemeI ccs, String source)
{
SliderPanel sp = null;
if (conservationSlider == null)
{
- sp = new SliderPanel(ap,
- collectionColourSchemeI.getConservationInc(), true,
- collectionColourSchemeI);
+ sp = new SliderPanel(ap, ccs.getConservationInc(), true, ccs);
conservationSlider = new Frame();
conservationSlider.add(sp);
}
else
{
sp = (SliderPanel) conservationSlider.getComponent(0);
- sp.cs = collectionColourSchemeI;
+ sp.cs = ccs;
+ sp.valueField.setText(String.valueOf(ccs.getConservationInc()));
}
conservationSlider
}
public static int setPIDSliderSource(AlignmentPanel ap,
- CollectionColourSchemeI collectionColourSchemeI, String source)
+ CollectionColourSchemeI ccs, String source)
{
SliderPanel pid = null;
if (PIDSlider == null)
{
- pid = new SliderPanel(ap, 50, false, collectionColourSchemeI);
+ pid = new SliderPanel(ap, ccs.getThreshold(), false, ccs);
PIDSlider = new Frame();
PIDSlider.add(pid);
}
else
{
pid = (SliderPanel) PIDSlider.getComponent(0);
- pid.cs = collectionColourSchemeI;
+ pid.cs = ccs;
+ pid.valueField.setText(String.valueOf(ccs.getThreshold()));
}
PIDSlider
.setTitle(MessageManager.formatMessage(
}
+ /**
+ * Hides the PID slider panel if it is shown
+ */
+ public static void hidePIDSlider()
+ {
+ if (PIDSlider != null)
+ {
+ PIDSlider.setVisible(false);
+ PIDSlider = null;
+ }
+ }
+
+ /**
+ * Hides the Conservation slider panel if it is shown
+ */
+ public static void hideConservationSlider()
+ {
+ if (conservationSlider != null)
+ {
+ conservationSlider.setVisible(false);
+ conservationSlider = null;
+ }
+ }
public SliderPanel(AlignmentPanel ap, int value, boolean forConserve,
CollectionColourSchemeI collectionColourSchemeI)
{
else
{
label.setText(MessageManager
- .getString("label.colour_residues_above_occurence"));
+ .getString("label.colour_residues_above_occurrence"));
slider.setMinimum(0);
slider.setMaximum(100 + slider.getVisibleAmount());
slider.setBlockIncrement(1);
{
try
{
- int i = Integer.parseInt(valueField.getText());
+ int i = Integer.valueOf(valueField.getText());
slider.setValue(i);
- } catch (Exception ex)
+ } catch (NumberFormatException ex)
{
- valueField.setText(slider.getValue() + "");
+ valueField.setText(String.valueOf(slider.getValue()));
}
}
valueField.setText(" ");
valueField.addActionListener(this);
valueField.setColumns(3);
+ valueField.addFocusListener(new FocusAdapter()
+ {
+ @Override
+ public void focusLost(FocusEvent e)
+ {
+ valueField_actionPerformed();
+ valueChanged(slider.getValue());
+ }
+ });
+
label.setFont(new java.awt.Font("Verdana", 0, 11));
label.setText(MessageManager.getString("label.set_this_label_text"));
jPanel1.setLayout(borderLayout1);