public class SliderSpecifier extends SpecifierPanel<Double>
Modifier and Type | Class and Description |
---|---|
static class |
SliderSpecifier.TextOption
Specifies whether and how a text display field should appear alongside
the slider for user entry.
|
Constructor and Description |
---|
SliderSpecifier(double lo,
double hi,
boolean log,
double reset)
Constructs a specifier with minimal options.
|
SliderSpecifier(double lo,
double hi,
boolean log,
double reset,
boolean flip,
SliderSpecifier.TextOption txtOpt)
Constructs a specifier with all options.
|
Modifier and Type | Method and Description |
---|---|
protected JComponent |
createComponent()
Abstract method called lazily during
getComponent
to obtain the graphical component used by this specifier. |
JSlider |
getSlider()
Returns the slider component used by this specifier.
|
double |
getSliderValue()
Returns the value currently represented by the slider,
regardless of whether the slider or text field is currently active.
|
Double |
getSpecifiedValue()
Returns the typed value currently specified by the graphical component.
|
JTextField |
getTextField()
Returns the text entry component used by this specifier.
|
double |
getTextValue()
Returns the value currently entered in the text field, regardless
of whether the text field or slider is currently active.
|
boolean |
isSliderActive()
Indicates whether the slider or the text field is the currently
selected input component.
|
void |
setSliderActive(boolean isActive)
Configures programmatically whether the slider or the text field is
the currently selected input component.
|
void |
setSpecifiedValue(Double dValue)
Sets the typed value represented by the graphical component.
|
void |
submitReport(ReportMap report)
Accepts information about a completed plot that was drawn with
input from this specifier.
|
String |
valueToString(double value)
Formats a value provided by this specifier for display.
|
addActionListener, fireAction, getActionForwarder, getChangeForwarder, getComponent, isXFill, removeActionListener
public SliderSpecifier(double lo, double hi, boolean log, double reset)
lo
- slider lower boundhi
- slider upper boundlog
- true for logarithmic slider scale, false for linearreset
- value reset button resets to, or NaN for no resetpublic SliderSpecifier(double lo, double hi, boolean log, double reset, boolean flip, SliderSpecifier.TextOption txtOpt)
lo
- slider lower boundhi
- slider upper boundlog
- true for logarithmic slider scale, false for linearreset
- value reset button resets to, or NaN for no resetflip
- true to make slider values increase right to lefttxtOpt
- configures whether a text field should appear;
null means NONEprotected JComponent createComponent()
SpecifierPanel
getComponent
to obtain the graphical component used by this specifier.
It will be called a maximum of once. It is not necessary that
the component actually be created in this method, for instance
it may be created at construction time if that's more convenient.createComponent
in class SpecifierPanel<Double>
public Double getSpecifiedValue()
Specifier
public void setSpecifiedValue(Double dValue)
Specifier
getSpecifiedValue
should yield the same result.
However if a value is set which is of the correct type but cannot be represented by this specifier, results are unpredictable.
dValue
- new valuepublic void submitReport(ReportMap report)
Specifier
report
- report of a plot partially specified by this objectpublic boolean isSliderActive()
public void setSliderActive(boolean isActive)
isActive
- true for slider, false for text fieldpublic double getTextValue()
public double getSliderValue()
public JSlider getSlider()
public JTextField getTextField()
public String valueToString(double value)
value
- double value as provided by this specifierCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.