Conflict in way transparency slider was inited - followed HEAD's pattern here.
@SuppressWarnings("serial")
public class AnnotationColourChooser extends AnnotationRowFilter
{
- private static final int ONETHOUSAND = 1000;
-
private ColourSchemeI oldcs;
private JButton defColours;
"error.implementation_error_dont_know_about_threshold_setting"));
}
thresholdIsMin.setSelected(acg.isThresholdIsMinMax());
- thresholdValue.setText("" + acg.getAnnotationThreshold());
+ thresholdValue
+ .setText(String.valueOf(acg.getAnnotationThreshold()));
}
jbInit();
{
updateView();
}
- getCurrentAnnotation().threshold.value = slider.getValue() / 1000f;
+ getCurrentAnnotation().threshold.value = getSliderValue();
propagateSeqAssociatedThreshold(updateAllAnnotation,
getCurrentAnnotation());
ap.paintAlignment(false, false);
thresholdValue.setEnabled(true);
thresholdIsMin.setEnabled(!useOriginalColours.isSelected());
+ final AlignmentAnnotation currentAnnotation = getCurrentAnnotation();
if (selectedThresholdItem == AnnotationColourGradient.NO_THRESHOLD)
{
slider.setEnabled(false);
thresholdIsMin.setEnabled(false);
}
else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD
- && getCurrentAnnotation().threshold == null)
+ && currentAnnotation.threshold == null)
{
- getCurrentAnnotation().setThreshold(new GraphLine(
- (getCurrentAnnotation().graphMax
- - getCurrentAnnotation().graphMin) / 2f,
+ currentAnnotation.setThreshold(new GraphLine(
+ (currentAnnotation.graphMax - currentAnnotation.graphMin)
+ / 2f,
"Threshold", Color.black));
}
if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD)
{
adjusting = true;
- float range = getCurrentAnnotation().graphMax * ONETHOUSAND
- - getCurrentAnnotation().graphMin * ONETHOUSAND;
-
- slider.setMinimum(
- (int) (getCurrentAnnotation().graphMin * ONETHOUSAND));
- slider.setMaximum(
- (int) (getCurrentAnnotation().graphMax * ONETHOUSAND));
- slider.setValue(
- (int) (getCurrentAnnotation().threshold.value * ONETHOUSAND));
- thresholdValue.setText(getCurrentAnnotation().threshold.value + "");
- slider.setMajorTickSpacing((int) (range / 10f));
+ setSliderModel(currentAnnotation.graphMin, currentAnnotation.graphMax,
+ currentAnnotation.threshold.value);
slider.setEnabled(true);
+
+ setThresholdValueText();
thresholdValue.setEnabled(true);
adjusting = false;
}
- colorAlignmentContaining(getCurrentAnnotation(), selectedThresholdItem);
+ colorAlignmentContaining(currentAnnotation, selectedThresholdItem);
ap.alignmentChanged();
}
package jalview.gui;
+import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.HiddenColumns;
import jalview.io.cache.JvCacheableInputBox;
import jalview.schemes.AnnotationColourGradient;
{
if (slider.isEnabled())
{
- getCurrentAnnotation().threshold.value = slider.getValue() / 1000f;
+ getCurrentAnnotation().threshold.value = getSliderValue();
updateView();
propagateSeqAssociatedThreshold(updateAllAnnotation,
getCurrentAnnotation());
thresholdValue.setEnabled(true);
percentThreshold.setEnabled(true);
+ final AlignmentAnnotation currentAnnotation = getCurrentAnnotation();
if (selectedThresholdItem == AnnotationColourGradient.NO_THRESHOLD)
{
slider.setEnabled(false);
}
else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD)
{
- if (getCurrentAnnotation().threshold == null)
+ if (currentAnnotation.threshold == null)
{
- getCurrentAnnotation().setThreshold(new jalview.datamodel.GraphLine(
- (getCurrentAnnotation().graphMax
- - getCurrentAnnotation().graphMin) / 2f,
+ currentAnnotation.setThreshold(new jalview.datamodel.GraphLine(
+ (currentAnnotation.graphMax
+ - currentAnnotation.graphMin) / 2f,
"Threshold", Color.black));
}
adjusting = true;
- float range = getCurrentAnnotation().graphMax * 1000
- - getCurrentAnnotation().graphMin * 1000;
- slider.setMinimum((int) (getCurrentAnnotation().graphMin * 1000));
- slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000));
- slider.setValue(
- (int) (getCurrentAnnotation().threshold.value * 1000));
+ setSliderModel(currentAnnotation.graphMin,
+ currentAnnotation.graphMax,
+ currentAnnotation.threshold.value);
setThresholdValueText();
- slider.setMajorTickSpacing((int) (range / 10f));
slider.setEnabled(true);
thresholdValue.setEnabled(true);
adjusting = false;
// build filter params
filterParams.setThresholdType(
AnnotationFilterParameter.ThresholdType.NO_THRESHOLD);
- if (getCurrentAnnotation().isQuantitative())
+ if (currentAnnotation.isQuantitative())
{
filterParams
- .setThresholdValue(getCurrentAnnotation().threshold.value);
+ .setThresholdValue(currentAnnotation.threshold.value);
if (selectedThresholdItem == AnnotationColourGradient.ABOVE_THRESHOLD)
{
// adding them to the selection
av.showAllHiddenColumns();
av.getColumnSelection().filterAnnotations(
- getCurrentAnnotation().annotations, filterParams);
+ currentAnnotation.annotations, filterParams);
boolean hideCols = getActionOption() == ACTION_OPTION_HIDE;
if (hideCols)
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.math.BigDecimal;
+import java.math.MathContext;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import javax.swing.JComboBox;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
-import javax.swing.JSlider;
import javax.swing.JTextField;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@SuppressWarnings("serial")
public abstract class AnnotationRowFilter extends JPanel
{
+ private static final String TWO_DP = "%.2f";
+
+ private final static MathContext FOUR_SIG_FIG = new MathContext(4);
+
protected AlignViewport av;
protected AlignmentPanel ap;
protected JCheckBox percentThreshold = new JCheckBox();
- protected JSlider slider = new JSlider();
+ protected Slider slider;
protected JTextField thresholdValue = new JTextField(20);
{
this.av = viewport;
this.ap = alignPanel;
+ this.slider = new Slider(0f, 100f, 50f);
+
thresholdValue.addFocusListener(new FocusAdapter()
{
@Override
adjusting = true;
if (percentThreshold.isSelected())
{
- thresholdValue.setText("" + (slider.getValue() - slider.getMinimum())
- * 100f / (slider.getMaximum() - slider.getMinimum()));
+ thresholdValue
+ .setText(String.format(TWO_DP, getSliderPercentageValue()));
}
else
{
- thresholdValue.setText((slider.getValue() / 1000f) + "");
+ /*
+ * round to 4 significant digits without trailing zeroes
+ */
+ float f = getSliderValue();
+ BigDecimal formatted = new BigDecimal(f).round(FOUR_SIG_FIG)
+ .stripTrailingZeros();
+ thresholdValue.setText(formatted.toPlainString());
}
adjusting = oldadj;
}
+ /**
+ * Answers the value of the slider position (descaled to 'true' value)
+ *
+ * @return
+ */
+ protected float getSliderValue()
+ {
+ return slider.getSliderValue();
+ }
+
+ /**
+ * Sets the slider value (scaled from the true value to the slider range)
+ *
+ * @param value
+ */
+ protected void setSliderValue(float value)
+ {
+ slider.setSliderValue(value);
+ }
+ /**
+ * Answers the value of the slider position as a percentage between minimum and
+ * maximum of its range
+ *
+ * @return
+ */
+ protected float getSliderPercentageValue()
+ {
+ return slider.getSliderPercentageValue();
+ }
+
+ /**
+ * Sets the slider position for a given percentage value of its min-max range
+ *
+ * @param pct
+ */
+ protected void setSliderPercentageValue(float pct)
+ {
+ slider.setSliderPercentageValue(pct);
+ }
+
protected void addSliderMouseListeners()
{
updateView();
}
+ /**
+ * Updates the slider position, and the display, for an update in the slider's
+ * text input field
+ */
protected void thresholdValue_actionPerformed()
{
try
float f = Float.parseFloat(thresholdValue.getText());
if (percentThreshold.isSelected())
{
- slider.setValue(slider.getMinimum() + ((int) ((f / 100f)
- * (slider.getMaximum() - slider.getMinimum()))));
+ setSliderPercentageValue(f);
}
else
{
- slider.setValue((int) (f * 1000));
+ setSliderValue(f);
}
updateView();
} catch (NumberFormatException ex)
valueChanged(true);
}
}
+
+ /**
+ * Sets the min-max range and current value of the slider, with rescaling from
+ * true values to slider range as required
+ *
+ * @param min
+ * @param max
+ * @param value
+ */
+ protected void setSliderModel(float min, float max, float value)
+ {
+ slider.setSliderModel(min, max, value);
+
+ /*
+ * tick mark every 10th position
+ */
+ slider.setMajorTickSpacing(
+ (slider.getMaximum() - slider.getMinimum()) / 10);
+ }
}
JPanel groupPanel;
- JSlider transparency = new JSlider();
+ JSlider transparency= new JSlider();
private JCheckBox showComplementOnTop;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.math.BigDecimal;
+import java.math.MathContext;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
-import javax.swing.JSlider;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
*/
public class FeatureTypeSettings extends JalviewDialog
{
+ private final static MathContext FOUR_SIG_FIG = new MathContext(4);
+
private final static String LABEL_18N = MessageManager
.getString("label.label");
private float max;
/*
- * scale factor for conversion between absolute min-max and slider
- */
- private float scaleFactor;
-
- /*
* radio button group, to select what to colour by:
* simple colour, by category (text), or graduated
*/
private JComboBox<Object> threshold = new JComboBox<>();
- private JSlider slider = new JSlider();
+ private Slider slider;
private JTextField thresholdValue = new JTextField(20);
* update min-max scaling if there is a range to work with,
* else disable the widgets (this shouldn't happen if only
* valid options are offered in the combo box)
+ * offset slider to have only non-negative values if necessary (JAL-2983)
*/
- scaleFactor = (max == min) ? 1f : 100f / (max - min);
- float range = (max - min) * scaleFactor;
- slider.setMinimum((int) (min * scaleFactor));
- slider.setMaximum((int) (max * scaleFactor));
- slider.setMajorTickSpacing((int) (range / 10f));
+ slider.setSliderModel(min, max, min);
+ slider.setMajorTickSpacing(
+ (int) ((slider.getMaximum() - slider.getMinimum()) / 10f));
threshline = new GraphLine((max - min) / 2f, "Threshold",
Color.black);
fc.isAboveThreshold() ? ABOVE_THRESHOLD_OPTION
: BELOW_THRESHOLD_OPTION);
slider.setEnabled(true);
- slider.setValue((int) (fc.getThreshold() * scaleFactor));
- thresholdValue.setText(String.valueOf(fc.getThreshold()));
+ slider.setSliderValue(fc.getThreshold());
+ setThresholdValueText(fc.getThreshold());
thresholdValue.setEnabled(true);
thresholdIsMin.setEnabled(true);
}
thresholdValue_actionPerformed();
}
});
+ slider = new Slider(0f, 100f, 50f);
slider.setPaintLabels(false);
slider.setPaintTicks(true);
slider.setBackground(Color.white);
{
if (!adjusting)
{
- thresholdValue
- .setText(String.valueOf(slider.getValue() / scaleFactor));
+ setThresholdValueText(slider.getSliderValue());
thresholdValue.setBackground(Color.white); // to reset red for invalid
sliderValueChanged();
}
float f = Float.parseFloat(thresholdValue.getText());
f = Float.max(f, this.min);
f = Float.min(f, this.max);
- thresholdValue.setText(String.valueOf(f));
- slider.setValue((int) (f * scaleFactor));
+ setThresholdValueText(f);
+ slider.setSliderValue(f);
threshline.value = f;
thresholdValue.setBackground(Color.white); // ok
adjusting = false;
}
/**
+ * Sets the text field for threshold value, rounded to four significant figures
+ *
+ * @param f
+ */
+ void setThresholdValueText(float f)
+ {
+ BigDecimal formatted = new BigDecimal(f).round(FOUR_SIG_FIG)
+ .stripTrailingZeros();
+ thresholdValue.setText(formatted.toPlainString());
+ }
+
+ /**
* Action on change of threshold slider value. This may be done interactively
* (by moving the slider), or programmatically (to update the slider after
* manual input of a threshold value).
*/
protected void sliderValueChanged()
{
- threshline.value = getRoundedSliderValue();
+ threshline.value = slider.getSliderValue();
/*
* repaint alignment, but not Overview or structure,
colourChanged(false);
}
- /**
- * Converts the slider value to its absolute value by dividing by the
- * scaleFactor. Rounding errors are squashed by forcing min/max of slider
- * range to the actual min/max of feature score range
- *
- * @return
- */
- private float getRoundedSliderValue()
- {
- int value = slider.getValue();
- float f = value == slider.getMaximum() ? max
- : (value == slider.getMinimum() ? min : value / scaleFactor);
- return f;
- }
-
void addActionListener(ActionListener listener)
{
if (featureSettings != null)
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
-import javax.swing.JSlider;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
boolean choice = false;
- JComboBox choicebox;
+ JComboBox<String> choicebox;
JPanel controlPanel = new JPanel();
boolean integ = false;
- Object lastVal;
+ String lastVal;
ParameterI parameter;
JButton showDesc = new JButton();
- JSlider slider = null;
+ Slider slider = null;
JTextArea string = new JTextArea();
validate();
}
- private void makeExpanderParam(ParameterI parm)
+ private void makeExpanderParam(final ParameterI parm)
{
setPreferredSize(new Dimension(PARAM_WIDTH, PARAM_CLOSEDHEIGHT));
setBorder(new TitledBorder(parm.getName()));
validate();
}
+ /**
+ * Action on input in text field
+ */
@Override
public void actionPerformed(ActionEvent e)
{
private void checkIfModified()
{
- Object cstate = updateSliderFromValueField();
- boolean notmod = false;
- if (cstate.getClass() == lastVal.getClass())
- {
- if (cstate instanceof int[])
- {
- notmod = (((int[]) cstate)[0] == ((int[]) lastVal)[0]);
- }
- else if (cstate instanceof float[])
- {
- notmod = (((float[]) cstate)[0] == ((float[]) lastVal)[0]);
- }
- else if (cstate instanceof String[])
- {
- notmod = (((String[]) cstate)[0].equals(((String[]) lastVal)[0]));
- }
- }
- pmdialogbox.argSetModified(this, !notmod);
+ Object cstate = getCurrentValue();
+ boolean modified = !cstate.equals(lastVal);
+ pmdialogbox.argSetModified(this, modified);
+ }
+
+ /**
+ * Answers the current value of the parameter, as text
+ *
+ * @return
+ */
+ private String getCurrentValue()
+ {
+ return choice ? (String) choicebox.getSelectedItem()
+ : valueField.getText();
}
@Override
}
+ /**
+ * Action on change of slider value
+ */
@Override
public void stateChanged(ChangeEvent e)
{
if (!adjusting)
{
- valueField.setText("" + ((integ) ? ("" + slider.getValue())
- : ("" + slider.getValue() / 1000f)));
+ float value = slider.getSliderValue();
+ valueField.setText(
+ integ ? Integer.toString((int) value)
+ : Float.toString(value));
checkIfModified();
}
-
}
public void updateControls(ParameterI parm)
}
else
{
- slider = new JSlider();
- slider.addChangeListener(this);
valueField = new JTextField();
valueField.addActionListener(this);
valueField.addKeyListener(new KeyListener()
}
});
valueField.setPreferredSize(new Dimension(60, 25));
+ slider = makeSlider(parm.getValidValue());
+ slider.addChangeListener(this);
+
controlPanel.add(slider, BorderLayout.WEST);
controlPanel.add(valueField, BorderLayout.EAST);
-
}
}
{
if (init)
{
- List vals = parm.getPossibleValues();
- for (Object val : vals)
+ List<String> vals = parm.getPossibleValues();
+ for (String val : vals)
{
choicebox.addItem(val);
}
valueField.setText(parm.getValue());
}
}
- lastVal = updateSliderFromValueField();
+ lastVal = getCurrentValue();
adjusting = false;
}
- public Object updateSliderFromValueField()
+ private Slider makeSlider(ValueConstrainI validValue)
+ {
+ if (validValue != null)
+ {
+ final Number minValue = validValue.getMin();
+ final Number maxValue = validValue.getMax();
+ if (minValue != null && maxValue != null)
+ {
+ return new Slider(minValue.floatValue(), maxValue.floatValue(),
+ minValue.floatValue());
+ }
+ }
+
+ /*
+ * otherwise, a nominal slider which will not be visible
+ */
+ return new Slider(0, 100, 50);
+ }
+
+ public void updateSliderFromValueField()
{
- int iVal;
- float fVal;
if (validator != null)
{
+ final Number minValue = validator.getMin();
+ final Number maxValue = validator.getMax();
if (integ)
{
- iVal = 0;
+ int iVal = 0;
try
{
valueField.setText(valueField.getText().trim());
iVal = Integer.valueOf(valueField.getText());
- if (validator.getMin() != null
- && validator.getMin().intValue() > iVal)
+ if (minValue != null
+ && minValue.intValue() > iVal)
{
- iVal = validator.getMin().intValue();
+ iVal = minValue.intValue();
// TODO: provide visual indication that hard limit was reached for
// this parameter
}
- if (validator.getMax() != null
- && validator.getMax().intValue() < iVal)
+ if (maxValue != null && maxValue.intValue() < iVal)
{
- iVal = validator.getMax().intValue();
- // TODO: provide visual indication that hard limit was reached for
- // this parameter
+ iVal = maxValue.intValue();
}
- } catch (Exception e)
+ } catch (NumberFormatException e)
{
+ System.err.println(e.toString());
}
- ;
- // update value field to reflect any bound checking we performed.
- valueField.setText("" + iVal);
- if (validator.getMin() != null && validator.getMax() != null)
+ if (minValue != null || maxValue != null)
{
- slider.getModel().setRangeProperties(iVal, 1,
- validator.getMin().intValue(),
- validator.getMax().intValue() + 1, true);
+ valueField.setText(String.valueOf(iVal));
+ slider.setSliderValue(iVal);
}
else
{
slider.setVisible(false);
}
- return new int[] { iVal };
}
else
{
- fVal = 0f;
+ float fVal = 0f;
try
{
valueField.setText(valueField.getText().trim());
fVal = Float.valueOf(valueField.getText());
- if (validator.getMin() != null
- && validator.getMin().floatValue() > fVal)
+ if (minValue != null
+ && minValue.floatValue() > fVal)
{
- fVal = validator.getMin().floatValue();
+ fVal = minValue.floatValue();
// TODO: provide visual indication that hard limit was reached for
// this parameter
// update value field to reflect any bound checking we performed.
valueField.setText("" + fVal);
}
- if (validator.getMax() != null
- && validator.getMax().floatValue() < fVal)
+ if (maxValue != null
+ && maxValue.floatValue() < fVal)
{
- fVal = validator.getMax().floatValue();
+ fVal = maxValue.floatValue();
// TODO: provide visual indication that hard limit was reached for
// this parameter
// update value field to reflect any bound checking we performed.
valueField.setText("" + fVal);
}
- } catch (Exception e)
+ } catch (NumberFormatException e)
{
+ System.err.println(e.toString());
}
- ;
- if (validator.getMin() != null && validator.getMax() != null)
+ if (minValue != null && maxValue != null)
{
- slider.getModel().setRangeProperties((int) (fVal * 1000f), 1,
- (int) (validator.getMin().floatValue() * 1000f),
- 1 + (int) (validator.getMax().floatValue() * 1000f),
- true);
+ slider.setSliderModel(minValue.floatValue(),
+ maxValue.floatValue(), fVal);
}
else
{
slider.setVisible(false);
}
- return new float[] { fVal };
}
}
else
if (!choice)
{
slider.setVisible(false);
- return new String[] { valueField.getText().trim() };
- }
- else
- {
- return new String[] { (String) choicebox.getSelectedItem() };
}
}
-
}
}
URL linkImageURL = getClass().getResource("/images/link.gif");
- Map<String, OptionBox> optSet = new java.util.LinkedHashMap<String, OptionBox>();
+ Map<String, OptionBox> optSet = new java.util.LinkedHashMap<>();
- Map<String, ParamBox> paramSet = new java.util.LinkedHashMap<String, ParamBox>();
+ Map<String, ParamBox> paramSet = new java.util.LinkedHashMap<>();
public Map<String, OptionBox> getOptSet()
{
*/
public List<ArgumentI> getCurrentSettings()
{
- List<ArgumentI> argSet = new ArrayList<ArgumentI>();
+ List<ArgumentI> argSet = new ArrayList<>();
for (OptionBox opts : getOptSet().values())
{
OptionI opt = opts.getOptionIfEnabled();
--- /dev/null
+package jalview.gui;
+
+import javax.swing.JSlider;
+
+/**
+ * A modified {@code javax.swing.JSlider} that
+ * <ul>
+ * <li>supports float valued numbers (by scaling up integer values)</li>
+ * <li>rescales 'true' value range to avoid negative values, as these are not
+ * rendered correctly by some look and feel libraries</li>
+ * </ul>
+ *
+ * @author gmcarstairs
+ */
+@SuppressWarnings("serial")
+public class Slider extends JSlider
+{
+ /*
+ * 'true' value corresponding to zero on the slider
+ */
+ private float trueMin;
+
+ /*
+ * 'true' value corresponding to slider maximum
+ */
+ private float trueMax;
+
+ /*
+ * scaleFactor applied to true value range to give a
+ * slider range of 0 - 100
+ */
+ private float sliderScaleFactor;
+
+ /**
+ * Constructor that rescales min - max to 0 - 100 for the slider
+ *
+ * @param min
+ * @param max
+ * @param value
+ */
+ public Slider(float min, float max, float value)
+ {
+ super();
+ setSliderModel(min, max, value);
+ }
+
+ /**
+ * Sets the min-max range and current value of the slider, with rescaling from
+ * true values to slider range as required
+ *
+ * @param min
+ * @param max
+ * @param value
+ */
+ public void setSliderModel(float min, float max, float value)
+ {
+ trueMin = min;
+ trueMax = max;
+ setMinimum(0);
+ sliderScaleFactor = 100f / (max - min);
+ int sliderMax = (int) ((max - min) * sliderScaleFactor);
+ int extent = 1;
+ setExtent(extent);
+ setMaximum(sliderMax + extent);
+ setSliderValue(value);
+ }
+
+ /**
+ * Answers the value of the slider position (descaled to 'true' value)
+ *
+ * @return
+ */
+ public float getSliderValue()
+ {
+ /*
+ * convert slider max to 'true max' in case of rounding errors
+ */
+ int value = getValue();
+ return value == getMaximum() ? trueMax
+ : value / sliderScaleFactor + trueMin;
+ }
+
+ /**
+ * Sets the slider value (scaled from the true value to the slider range)
+ *
+ * @param value
+ */
+ public void setSliderValue(float value)
+ {
+ setValue(Math.round((value - trueMin) * sliderScaleFactor));
+ }
+
+ /**
+ * Answers the value of the slider position as a percentage between minimum and
+ * maximum of its range
+ *
+ * @return
+ */
+ public float getSliderPercentageValue()
+ {
+ return (getValue() - getMinimum()) * 100f
+ / (getMaximum() - getMinimum());
+ }
+
+ /**
+ * Sets the slider position for a given percentage value of its min-max range
+ *
+ * @param pct
+ */
+ public void setSliderPercentageValue(float pct)
+ {
+ float pc = pct / 100f * getMaximum();
+ setValue((int) pc);
+ }
+}