All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.hdf.awt.Slider

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----ncsa.hdf.awt.Slider

public class Slider
extends Canvas
implements MouseListener, MouseMotionListener
A Slider is a widget that varies between a minimum and a maximum value. Draging on a "thumb" can change the current value.

Version:
1.00
Author:
Xinjian Lu (xlu@ncsa.uiuc.edu) HDF Group, NCSA

Variable Index

 o PERCENTAGE
 o sliderListener
 o SLIDERVALUE

Constructor Index

 o Slider()
Constructs a slider.

Method Index

 o addSliderListener(SliderListener)
 o adjustThumbPos()
adjust thumb position
 o doMouseDown()
This method is called when the mouse is pressed on the the "thumb" .
 o doMouseDrag()
This method is called when the "thumb" is dragged by the user.
 o doMouseRelease()
This method is called when the mouse is released.
 o getMaximum()
return the maximum value for the slider.
 o getMinimum()
return the mininum value for the slider.
 o getRatio()
Returns the current ratio for the current position in the slider.
 o getSliderValue()
return the value that slider replace.
 o getValue()
Returns the current value of the slider.
 o handleMouseEvent(int)
Handle the mouse event
 o main(String[])
It is called automatically by the system the application is started.
 o mouseClicked(MouseEvent)
 o mouseDragged(MouseEvent)
 o mouseEntered(MouseEvent)
 o mouseExited(MouseEvent)
 o mouseMoved(MouseEvent)
 o mousePressed(MouseEvent)
 o mouseReleased(MouseEvent)
 o paint(Graphics)
Paints the component.
 o postSliderEvent()
 o processEvent(AWTEvent)
 o removeSliderListener(SliderListener)
 o selfChangedValue()
 o setBackgroundColor(Color)
set the background color for the slider.
 o setBarColor(Color)
set the color for the slider's bar.
 o setBaseValue(int)
set the base number which slider can stand for
 o setBounds(int, int, int, int)
resize the canvas.
 o setDispMode(int)
set display mode of slider value
 o setHeight(int)
set the slider height
 o setMaximum(int)
sets the maximum value for the slider.
 o setMinimum(int)
sets the minimum value for the slider.
 o setSlashColor(Color)
Sets the slash color for the slider.
 o setSliderChanged()
 o setSliderRange(double, double)
set the slider range
 o setSliderUnchanged()
 o setSliderValue(double)
set the value that slider replace.
 o setThumbColor(Color)
set the color for the slider's thumb.
 o setValue(int)
set the slider value
 o setWidth(int)
set the slider width
 o sliderChanged()
 o update(Graphics)
Updates the component.

Variables

 o PERCENTAGE
 public static final int PERCENTAGE
 o SLIDERVALUE
 public static final int SLIDERVALUE
 o sliderListener
 protected SliderListener sliderListener

Constructors

 o Slider
 public Slider()
Constructs a slider.

Methods

 o main
 public static void main(String args[])
It is called automatically by the system the application is started.

 o setBackgroundColor
 public void setBackgroundColor(Color color)
set the background color for the slider.

Parameters:
color - the new background color.
 o setThumbColor
 public void setThumbColor(Color color)
set the color for the slider's thumb.

Parameters:
color - the new thumb color.
 o setBarColor
 public void setBarColor(Color color)
set the color for the slider's bar.

Parameters:
color - new bar color.
 o setBounds
 public void setBounds(int x,
                       int y,
                       int width,
                       int height)
resize the canvas.

Overrides:
setBounds in class Component
 o setSlashColor
 public void setSlashColor(Color color)
Sets the slash color for the slider.

Parameters:
color - The new slash color.
 o setWidth
 public void setWidth(int w)
set the slider width

Parameters:
val - the slider width to set
 o setHeight
 public void setHeight(int h)
set the slider height

Parameters:
val - the slider height to set
 o adjustThumbPos
 public void adjustThumbPos()
adjust thumb position

 o setBaseValue
 public void setBaseValue(int val)
set the base number which slider can stand for

Parameters:
val - the base value
 o setDispMode
 public void setDispMode(int val)
set display mode of slider value

Parameters:
val - the display mode
 o setSliderRange
 public void setSliderRange(double min,
                            double max)
set the slider range

Parameters:
min - the range value
max - the range value
 o setSliderValue
 public void setSliderValue(double val)
set the value that slider replace.

 o getSliderValue
 public double getSliderValue()
return the value that slider replace.

 o setValue
 public void setValue(int val)
set the slider value

Parameters:
val - the slider value
 o getValue
 public int getValue()
Returns the current value of the slider.

Returns:
The current value of the slider.
 o getRatio
 public double getRatio()
Returns the current ratio for the current position in the slider.

Returns:
the current ratio for the current position in the slider.
 o setMaximum
 public void setMaximum(int num)
sets the maximum value for the slider.

Parameters:
num - the new maximum value.
 o getMaximum
 public int getMaximum()
return the maximum value for the slider.

 o setMinimum
 public void setMinimum(int num)
sets the minimum value for the slider.

Parameters:
num - the new minimum value.
 o getMinimum
 public int getMinimum()
return the mininum value for the slider.

 o selfChangedValue
 public void selfChangedValue()
 o update
 public void update(Graphics g)
Updates the component. This method is called in response to a call to repaint. You can assume that the background is not cleared.

Parameters:
g - the specified Graphics window
Overrides:
update in class Component
See Also:
update
 o paint
 public void paint(Graphics g)
Paints the component.

Parameters:
g - the specified Graphics window
Overrides:
paint in class Canvas
See Also:
paint
 o handleMouseEvent
 public void handleMouseEvent(int x)
Handle the mouse event

Parameters:
x - the slide position
 o mousePressed
 public void mousePressed(MouseEvent me)
 o mouseReleased
 public void mouseReleased(MouseEvent me)
 o mouseEntered
 public void mouseEntered(MouseEvent me)
 o mouseExited
 public void mouseExited(MouseEvent me)
 o mouseClicked
 public void mouseClicked(MouseEvent me)
 o mouseMoved
 public void mouseMoved(MouseEvent me)
 o mouseDragged
 public void mouseDragged(MouseEvent me)
 o doMouseDrag
 public void doMouseDrag()
This method is called when the "thumb" is dragged by the user. Be overridden for some behavior.

 o doMouseDown
 public void doMouseDown()
This method is called when the mouse is pressed on the the "thumb" . Remember to overridden if you want to have some action for that.

 o doMouseRelease
 public void doMouseRelease()
This method is called when the mouse is released. Be overridden for some action to do.

 o sliderChanged
 public boolean sliderChanged()
 o setSliderChanged
 public void setSliderChanged()
 o setSliderUnchanged
 public void setSliderUnchanged()
 o addSliderListener
 public synchronized void addSliderListener(SliderListener l)
 o removeSliderListener
 public synchronized void removeSliderListener(SliderListener l)
 o postSliderEvent
 protected void postSliderEvent()
 o processEvent
 protected void processEvent(AWTEvent evt)
Overrides:
processEvent in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index