|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gishur.awt.SymbolbarElement | +--gishur.awt.SymbolbarSlider
A Symbolbarelement class that represents a slider. The values in the slider
range from 0
to a specified maximum value. The smallest
increment / decrement of the value is 1
. To map the slider value
to real world values, one has to transform the values outside of this control.
The labels of the slider - three labels (one left, one right and one in the middle)
are possible - can be specified freely via the methods setLeftText(java.lang.String)
,
setRightText(java.lang.String)
and setMidText(java.lang.String)
. If the value of the slider changes,
by user interaction or by a call to the setValue(int)
method, an action event
of the type SYMBOLSLIDER_VALUE_CHANGED
will be dispatched at the symbolbar.
It is possible to set the slider bar value without dispatching events (see
setValueTo(int)
method) and to change the maximum value dynamically (see
setMaxValue(int)
).
Field Summary | |
java.awt.Color |
back_color
The background color. |
java.awt.Color |
bar_color
The color of the bar. |
int |
bar_height
Height of the slider bar. |
java.awt.Font |
font
font of the _slider label |
int |
hspace
Distance to the left and right border. |
int |
slider_size
Size of the Slider. |
int |
slider_voffset
Vertical distance of the slider from center position. |
static int |
SYMBOLSLIDER_VALUE_CHANGED
ActionEvent-Type: Changed Value |
java.awt.Color |
text_color
The forground color. |
java.awt.Color |
text_value_color
The color of the value-text. |
int |
text_voffset
Vertical distance of the text from the slider bar. |
Fields inherited from class gishur.awt.SymbolbarElement |
_needs_repaint, command, label, width |
Constructor Summary | |
SymbolbarSlider(java.lang.String label,
java.lang.String command,
int width,
int max_value)
Constructor. |
Method Summary | |
void |
disableNumberedValues()
Disables automatical printing of numbered labels and values. |
java.lang.String |
leftText()
|
int |
maxValue()
Returns the maximum value of the slider. |
java.lang.String |
midText()
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a component. |
void |
mouseDragged(java.awt.event.MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged. |
void |
mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component. |
java.lang.String |
rightText()
|
void |
setLeftText(java.lang.String text)
|
void |
setMaxValue(int max)
Sets the maximum value of the slider (must be >=0).
|
void |
setMidText(java.lang.String text)
|
void |
setNumberedLabels(int offset)
Sets the text labels to the min/max numbers, where the minimum label is the given offset and the maximum label is offset+ . |
void |
setNumberedValues(int offset)
Sets automatical printing of numbered labels and values. |
void |
setRightText(java.lang.String text)
|
void |
setValue(int value)
Sets the value of the slider to the given value and dispatches a value-changed event at the parent symbolbar. |
void |
setValueText(java.lang.String text)
|
void |
setValueTo(int val)
Sets the slider value to the specified value without dispatching events. |
void |
update(java.awt.Graphics g,
int height)
Redraw the element. |
int |
value()
Returns the slider value (ranging from 0 to the
maximum value). |
java.lang.String |
valueText()
|
Methods inherited from class gishur.awt.SymbolbarElement |
active, disable, enable, enabled, getCommand, getLabel, getParent, getPreferredHeight, getSize, mouseEntered, mouseExited, mouseMoved, setActive, setCommand, setLabel, setParent, setSize |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int SYMBOLSLIDER_VALUE_CHANGED
public java.awt.Font font
public java.awt.Color text_color
public java.awt.Color text_value_color
public java.awt.Color back_color
public java.awt.Color bar_color
public int hspace
public int bar_height
public int slider_size
public int slider_voffset
public int text_voffset
Constructor Detail |
public SymbolbarSlider(java.lang.String label, java.lang.String command, int width, int max_value)
label
- the label string of the slidercommand
- the command string of the sliderwidth
- the width of the elementmax_value
- the maximum value of the sliderMethod Detail |
public void update(java.awt.Graphics g, int height)
update
in class SymbolbarElement
g
- the graphics on which we draw.height
- of the redrawing area.public void setNumberedValues(int offset)
offset
- the offset for displayed valuessetNumberedValues(int)
public void disableNumberedValues()
setLeftText(java.lang.String)
, setMidText(java.lang.String)
,
setRightText(java.lang.String)
and setValueText(java.lang.String)
.setNumberedValues(int)
public void setLeftText(java.lang.String text)
public java.lang.String leftText()
public void setRightText(java.lang.String text)
public java.lang.String rightText()
public void setMidText(java.lang.String text)
public java.lang.String midText()
public void setValueText(java.lang.String text)
public java.lang.String valueText()
public int value()
0
to the
maximum value).public void setValueTo(int val)
val
- new slider valuepublic int maxValue()
public void setMaxValue(int max)
>=0).
This method does not relabel the left/mid/right labels!
- Parameters:
max
- new maximum value
public void setNumberedLabels(int offset)
offset+maxValue()
()
.public void setValue(int value)
value
- new valuepublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in class SymbolbarElement
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in class SymbolbarElement
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in class SymbolbarElement
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in class SymbolbarElement
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |