|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--org.zaval.util.ValidationObject
|
+--org.zaval.lw.LwCanvas
|
+--org.zaval.lw.LwSlider
This is slider component that can be used to select a value from the
specified integer interval. The minimum, maximum, intervals sizes and other properties
are specified by setValues method. The table below explains the
properties meaning in more detail:
| Property | Description |
| max |
This is maximum possible value of the slider interval. Use getMax
method to get the property value. It is impossible to set a slider value that is
greater than the maximum.
|
| min |
This is minimum possible value of the slider interval. Use getMin
method to get the property value. It is impossible to set a slider value that is
less than the minimum.
|
| roughStep | This property defines a rough step that is used to change current slider value for none-interval slider model. The step is used (to change the slider value) when the left mouse button has been pressed. |
| exactStep | This property defines an exact step that is used to change current slider value for none-interval slider model. The step is used (to change the slider value) when appropriate key has been pressed or mouse drag event has been performed. |
| interval[] | This property defines slider intervals sizes. The intervals are used to navigate through the slider component for interval model. The painting process uses the intervals to render scale and the scale titles. |
| isIntervalModel |
This property defines navigation model. There are two possible models:
|
setView method. The component uses "sl.hbundle"
(horizontal slider), "sl.vbundle" (vertical slider) and "sl.gauge" (gauge view)
static views as the default.
showScale and showTitle methods.
setViewProvider method to customize the titles views.
setOrientation method to define the slider orientation.
| Field Summary | |
static int |
BUNDLE_VIEW
The bundle view id. |
static int |
GAUGE_VIEW
The gauge view id. |
| Fields inherited from class org.zaval.lw.LwCanvas |
bits, height, insets, parent, psHeight, psWidth, skins, width, x, y |
| Fields inherited from class org.zaval.util.ValidationObject |
isValidFlag |
| Constructor Summary | |
LwSlider()
Constructs a slider. |
|
LwSlider(int o)
Constructs a slider with the specified orientation. |
|
| Method Summary | |
void |
addActionListener(LwActionListener l)
Adds the specified action listener to receive action events from this slider. |
protected java.awt.Dimension |
calcPreferredSize()
Gets the "pure" preferred size for this component. |
boolean |
canHaveFocus()
Specifies if the component can have focus. |
void |
endDragged(LwMouseMotionEvent e)
Invoked when the mouse ends dragged. |
int |
findNearest(int x,
int y)
Finds nearest slider value where a bundle can be moved by the specified location. |
int |
getIntervals()
Gets the number of the slider intervals. |
int |
getIntervalSize(int i)
Gets the specified interval size. |
int |
getMax()
Gets the maximal possible value. |
int |
getMin()
Gets the minimal possible value. |
int |
getOrientation()
Gets the slider orientation. |
int |
getPointValue(int i)
Gets the start value for the specified interval. |
java.awt.Color |
getScaleColor()
Gets the scale color. |
int |
getScaleGap()
Gets the scale gap. |
int |
getValue()
Gets the current slider value. |
LwView |
getView(Drawable d,
java.lang.Object o)
Gets the view for the specified object of the specified component. |
LwView |
getView(int id)
Gets the view of the specified slider element. |
void |
invalidate()
Invalidates this component. |
boolean |
isIntervalModel()
Tests if the interval model is used to navigate through the slider. |
boolean |
isJumpOnPress()
Tests if the slider value will be changed according to the mouse cursor location by mouse presssed event. |
void |
jumpOnPress(boolean b)
Sets if the slider value should be changed according to the mouse cursor location by mouse presssed event. |
void |
keyPressed(LwKeyEvent e)
Invoked when a key has been pressed. |
void |
keyReleased(LwKeyEvent e)
Invoked when a key has been released. |
void |
keyTyped(LwKeyEvent e)
Invoked when a key has been typed. |
int |
loc2value(int xy)
Converts the specified location to a slider value. |
void |
mouseClicked(LwMouseEvent e)
Invoked when the mouse button has been clicked on a light weight component. |
void |
mouseDragged(LwMouseMotionEvent e)
Invoked when a mouse button is pressed on a component and then dragged. |
void |
mouseEntered(LwMouseEvent e)
Invoked when the mouse enters a light weight component. |
void |
mouseExited(LwMouseEvent e)
Invoked when the mouse exits a light weight component. |
void |
mouseMoved(LwMouseMotionEvent e)
Invoked when the mouse pointer has been moved on a light weight component (with no buttons no down). |
void |
mousePressed(LwMouseEvent e)
Invoked when the mouse button has been pressed on a light weight component. |
void |
mouseReleased(LwMouseEvent e)
Invoked when the mouse button has been released on a light weight component. |
void |
paint(java.awt.Graphics g)
Paints this component. |
protected void |
recalc()
Invoked with validate method only if the component is not valid. |
void |
removeActionListener(LwActionListener l)
Removes the specified action listener so it no longer receives action events from this component. |
void |
setOrientation(int o)
Sets the specified slider orientation. |
void |
setScaleColor(java.awt.Color c)
Sets the scale color. |
void |
setScaleGap(int g)
Sets the specified scale gap. |
void |
setScaleStep(int s)
Sets the scale step. |
void |
setValue(int v)
Sets the specified slider value. |
void |
setValues(int min,
int max,
int[] intervals,
int roughStep,
int exactStep)
Sets the slider properties. |
void |
setView(int id,
LwView v)
Sets the view for the specified slider element. |
void |
setViewProvider(LwViewProvider p)
Sets the specified titles views provider. |
void |
showScale(boolean b)
Sets the scale element visibility. |
void |
showTitle(boolean b)
Sets the slider title visibility. |
void |
startDragged(LwMouseMotionEvent e)
Invoked when the mouse starts dragged. |
void |
useIntervalModel(boolean b)
Sets the specified navigation model. |
int |
value2loc(int v)
Converts the specified slider value to a location. |
| Methods inherited from class org.zaval.lw.LwCanvas |
getBackground, getBounds, getHeight, getInsets, getLocation, getLwComponentAt, getLwParent, getOrigin, getPreferredSize, getSize, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, isEnabled, isOpaque, isVisible, repaint, repaint, requestFocus, setBackground, setEnabled, setInsets, setLocation, setLwParent, setOpaque, setPSSize, setSize, setViewMan, setVisible, toString, update, validate, viewManChanged, vrp |
| Methods inherited from class org.zaval.util.ValidationObject |
isValid |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.zaval.util.Validationable |
isValid |
| Field Detail |
public static final int BUNDLE_VIEW
public static final int GAUGE_VIEW
| Constructor Detail |
public LwSlider()
public LwSlider(int o)
o - the specified orientation.| Method Detail |
public boolean canHaveFocus()
LwComponentcanHaveFocus in class LwCanvasorg.zaval.lw.LwComponenttrue if the component can have the focus.public int getScaleGap()
public void setScaleGap(int g)
g - the specified scale gap.public java.awt.Color getScaleColor()
public void setScaleColor(java.awt.Color c)
c - the scale color.public void setScaleStep(int s)
s - the scale step.public void showScale(boolean b)
b - the scale element visibility.public boolean isJumpOnPress()
true if the slider value is changed by mouse pressed event
according to the mouse cursor location.public void jumpOnPress(boolean b)
b - use true as the argument value to allow the slider
value changing by mouse pressed event according to the mouse cursor location.public void showTitle(boolean b)
b - the slider title visibility.public void setViewProvider(LwViewProvider p)
p - the specified titles views provider.
public LwView getView(Drawable d,
java.lang.Object o)
LwViewProvidergetView in interface LwViewProviderorg.zaval.lw.LwViewProviderd - the specified component.obj - the specified object.public void setOrientation(int o)
o - the specified slider orientation.public int getOrientation()
public LwView getView(int id)
id - the specified slider element id.
public void setView(int id,
LwView v)
id - the specified slider element id.v - the specified view.public boolean isIntervalModel()
true if the interval model is used; otherwise false.public void useIntervalModel(boolean b)
b - specified navigation model. Use true to set interval
model; otherwise false.public int getValue()
public void setValue(int v)
v - the specified slider value.public int getMax()
public int getMin()
public int getIntervals()
public int getIntervalSize(int i)
i - the specified interval index.
public void setValues(int min,
int max,
int[] intervals,
int roughStep,
int exactStep)
min - the specified minimal possible value.max - the specified maximal possible value.intervals - the specified intervals sizes array.roughStep - the specified rough step. The step is used to change
the slider value whenever the mouse button has been pressed.exactStep - the specified exact step. The step is used to change
the slider value whenever the mouse has been dragged or appropriate key has been pressed.public int getPointValue(int i)
i - the specified interval index.public void addActionListener(LwActionListener l)
l - the specified action listener.public void removeActionListener(LwActionListener l)
l - the specified action listener.public void keyPressed(LwKeyEvent e)
LwKeyListenerkeyPressed in interface LwKeyListenerorg.zaval.lw.event.LwKeyListenere - the specified key event.public void mousePressed(LwMouseEvent e)
LwMouseListenermousePressed in interface LwMouseListenerorg.zaval.lw.event.LwMouseListenere - the specified mouse event.public void startDragged(LwMouseMotionEvent e)
LwMouseMotionListenerstartDragged in interface LwMouseMotionListenerorg.zaval.lw.event.LwMouseMotionListenere - the specified mouse motion event.public void endDragged(LwMouseMotionEvent e)
LwMouseMotionListenerendDragged in interface LwMouseMotionListenerorg.zaval.lw.event.LwMouseMotionListenere - the specified mouse motion event.public void mouseDragged(LwMouseMotionEvent e)
LwMouseMotionListenermouseDragged in interface LwMouseMotionListenerorg.zaval.lw.event.LwMouseMotionListenere - the specified mouse motion event.public void keyReleased(LwKeyEvent e)
LwKeyListenerkeyReleased in interface LwKeyListenerorg.zaval.lw.event.LwKeyListenere - the specified key event.public void keyTyped(LwKeyEvent e)
LwKeyListenerkeyTyped in interface LwKeyListenerorg.zaval.lw.event.LwKeyListenere - the specified key event.public void mouseClicked(LwMouseEvent e)
LwMouseListenermouseClicked in interface LwMouseListenerorg.zaval.lw.event.LwMouseListenere - the specified mouse event.public void mouseEntered(LwMouseEvent e)
LwMouseListenermouseEntered in interface LwMouseListenerorg.zaval.lw.event.LwMouseListenere - the specified mouse event.public void mouseExited(LwMouseEvent e)
LwMouseListenermouseExited in interface LwMouseListenerorg.zaval.lw.event.LwMouseListenere - the specified mouse event.public void mouseReleased(LwMouseEvent e)
LwMouseListenermouseReleased in interface LwMouseListenerorg.zaval.lw.event.LwMouseListenere - the specified mouse event.public void mouseMoved(LwMouseMotionEvent e)
LwMouseMotionListenermouseMoved in interface LwMouseMotionListenerorg.zaval.lw.event.LwMouseMotionListenere - the specified mouse motion event.public void paint(java.awt.Graphics g)
LwCanvaspaint in class LwCanvasorg.zaval.lw.LwCanvasg - the graphics context to be used for painting.
public int findNearest(int x,
int y)
x - the specified x coordinate.y - the specified y coordinate.public int value2loc(int v)
v - the specified slider value.public int loc2value(int xy)
xy - the specified location.public void invalidate()
LwCanvasinvalidate in class LwCanvasprotected java.awt.Dimension calcPreferredSize()
LwCanvasgetPreferredSize method.calcPreferredSize in class LwCanvasorg.zaval.lw.LwCanvasprotected void recalc()
LwCanvasvalidate method only if the component is not valid.
The method shoud be overrided to calculate metrical characteristics of the component to
minimize computation time of the preferred size for the component. For example, you can
calculate a preferred size inside the method and just return it by
calcPreferredSize method.recalc in class LwCanvas
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||