All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Acme.Widgets.Slider

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----Acme.Widgets.Slider

public class Slider
extends Canvas
A slider widget.

A slider is a widget that varies between a minimum and a maximum value. The user can drag a "thumb" to change the current value. As the slider is dragged, Motion() is called. When the slider is released, Release() is called. Override these two methods to give the slider behavior.

This is (strongly) based on a version by Adam Doppelt.

Fetch the software.
Fetch the entire Acme package.


Constructor Index

 o Slider()
Constructor, all default values.
 o Slider(int, int)
Constructor, some specified values.
 o Slider(int, int, int)
Constructor, some specified values.

Method Index

 o getValue()
Returns the current value for the slider.
 o motion()
This method is called when the "thumb" of the slider is moved by the user.
 o mouseDown(Event, int, int)
 o mouseDrag(Event, int, int)
 o mouseUp(Event, int, int)
 o paint(Graphics)
 o release()
This method is called when the "thumb" of the slider is released after being moved.
 o setBarColor(Color)
Sets the color for the slider's bar.
 o setBounds(int, int, int, int)
 o setHeight(int)
Sets the height of the slider.
 o setLineColor(Color)
Sets the line color for the slider - the little vertical line on the thumb.
 o setMaximum(int)
Sets the maximum value for the slider.
 o setMinimum(int)
Sets the minimum value for the slider.
 o setTextColor(Color)
Sets the color for the slider`s text.
 o setThumbColor(Color)
Sets the color for the slider's thumb.
 o setValue(int)
Sets the current value for the slider.
 o setWidth(int)
Sets the width of the slider.

Constructors

 o Slider
 public Slider()
Constructor, all default values.

 o Slider
 public Slider(int valueMin,
               int valueMax)
Constructor, some specified values.

 o Slider
 public Slider(int valueMin,
               int valueMax,
               int width)
Constructor, some specified values.

Methods

 o motion
 public void motion()
This method is called when the "thumb" of the slider is moved by the user. May be overridden to give the slider some behavior.

 o release
 public void release()
This method is called when the "thumb" of the slider is released after being moved. May be overridden to give the slider some behavior.

 o setMaximum
 public void setMaximum(int num)
Sets the maximum value for the slider.

Parameters:
num - The new maximum.
 o setMinimum
 public void setMinimum(int num)
Sets the minimum value for the slider.

Parameters:
num - The new minimum.
 o setValue
 public void setValue(int num)
Sets the current value for the slider. The thumb will move to reflect the new setting.

Parameters:
num - The new setting for the slider.
 o setHeight
 public void setHeight(int num)
Sets the height of the slider. This is the height of the entire slider canvas, including space reserved for displaying the current value.

Parameters:
num - The new height.
 o setWidth
 public void setWidth(int num)
Sets the width of the slider. This is the width of the actual slider box.

Parameters:
num - The new width.
 o setBarColor
 public void setBarColor(Color color)
Sets the color for the slider's bar. The "bar" is the rectangle that the thumb slides around in.

Parameters:
color - The new bar color.
 o setThumbColor
 public void setThumbColor(Color color)
Sets the color for the slider's thumb. The "thumb" is the box that the user can slide back and forth.

Parameters:
color - The new thumb color.
 o setLineColor
 public void setLineColor(Color color)
Sets the line color for the slider - the little vertical line on the thumb.

Parameters:
color - The new line color.
 o setTextColor
 public void setTextColor(Color color)
Sets the color for the slider`s text.

Parameters:
color - The new text color.
 o getValue
 public int getValue()
Returns the current value for the slider.

Returns:
The current value for the slider.
 o paint
 public void paint(Graphics g)
Overrides:
paint in class Canvas
 o setBounds
 public void setBounds(int x,
                       int y,
                       int width,
                       int height)
Overrides:
setBounds in class Component
 o mouseDown
 public boolean mouseDown(Event e,
                          int x,
                          int y)
Overrides:
mouseDown in class Component
 o mouseDrag
 public boolean mouseDrag(Event e,
                          int x,
                          int y)
Overrides:
mouseDrag in class Component
 o mouseUp
 public boolean mouseUp(Event e,
                        int x,
                        int y)
Overrides:
mouseUp in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index

ACME Java  ACME Labs