Class dpscomponents.slider.MightySlider
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dpscomponents.slider.MightySlider

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----dpscomponents.slider.MightySlider

public class MightySlider
extends Canvas
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.
Version:
2.00, 29 December 1995
Authors:
Adam Doppelt,
with some significant modifications by
Benjamin "Quincy" Cabell V,
Besiex Software.

Variable Index

 o BUFFER
 o DEFAULT_DOUBLE_MAX
 o DEFAULT_DOUBLE_MIN
 o DEFAULT_HEIGHT
 o DEFAULT_WIDTH
 o MIN_HEIGHT
 o MIN_WIDTH
 o TEXT_BUFFER
 o TEXT_HEIGHT
 o THUMB_SIZE

Constructor Index

 o MightySlider()
Constructs a slider.

Method Index

 o GetValue()
Returns the current value for the slider.
 o minimumSize()
The minimum size of this slider is determined by any resizes the user has called on this component between the time it was instantiated and the time at which it is added to the layout manager (which calls this minimumSize() method), or if the user has not resized this component, the default height and width are used.
 o Motion()
This method is called when the "thumb" of the slider is dragged by the user.
 o mouseDown(Event, int, int)
An internal method used to handle mouse down events.
 o mouseDrag(Event, int, int)
An internal method used to handle mouse drag events.
 o mouseUp(Event, int, int)
An internal method used to handle mouse up events.
 o paint(Graphics)
An internal method used to handle repaint events.
 o preferredSize()
The preferred size for this slider component is the same as its minimum size.
 o Release()
This method is called when the "thumb" of the slider is released after being dragged.
 o reshape(int, int, int, int)
An internal method used to handle resizing.
 o SetBackgroundColor(Color)
Sets the background color for the slider.
 o SetBarColor(Color)
Sets the color for the slider's bar.
 o SetDoubleMode(boolean)
 o SetFont(Font)
Sets the font for the slider`s text.
 o SetHeight(int)
Sets the height of the slider.
 o SetMaximum(double)
Sets the maximum value for the slider.
 o SetMaximum(int)
Sets the maximum value for the slider.
 o SetMinimum(double)
Sets the minimum 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 SetTextColor(Color)
Sets the color for the slider`s text.
 o SetThumbColor(Color)
Sets the color for the slider's thumb.
 o SetValue(double)
Sets the current value for the slider.
 o SetValue(int)
Sets the current value for the slider.
 o SetWidth(int)
Sets the width of the slider.

Variables

 o THUMB_SIZE
  protected final static int THUMB_SIZE
 o BUFFER
  protected final static int BUFFER
 o TEXT_HEIGHT
  protected final static int TEXT_HEIGHT
 o TEXT_BUFFER
  protected final static int TEXT_BUFFER
 o DEFAULT_WIDTH
  protected final static int DEFAULT_WIDTH
 o DEFAULT_HEIGHT
  protected final static int DEFAULT_HEIGHT
 o MIN_WIDTH
  protected final static int MIN_WIDTH
 o MIN_HEIGHT
  protected final static int MIN_HEIGHT
 o DEFAULT_DOUBLE_MIN
  protected final static double DEFAULT_DOUBLE_MIN
 o DEFAULT_DOUBLE_MAX
  protected final static double DEFAULT_DOUBLE_MAX

Constructors

 o MightySlider
  public MightySlider()
Constructs a slider.

Methods

 o SetDoubleMode
  public void SetDoubleMode(boolean theMode)
 o preferredSize
  public Dimension preferredSize()
The preferred size for this slider component is the same as its minimum size.
Overrides:
preferredSize in class Component
 o minimumSize
  public Dimension minimumSize()
The minimum size of this slider is determined by any resizes the user has called on this component between the time it was instantiated and the time at which it is added to the layout manager (which calls this minimumSize() method), or if the user has not resized this component, the default height and width are used. The programmer should be careful to ensure that they do not resize this component to a size smaller than is needed to fit the display value (since no checking is done here to prevent that case).
Overrides:
minimumSize in class Component
 o Motion
  public void Motion()
This method is called when the "thumb" of the slider is dragged by the user. Must 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 dragged. Must be overridden to give the slider some behavior.
 o SetMaximum
  public void SetMaximum(double num)
Sets the maximum value for the slider.
Parameters:
num - The new maximum (passed as a double).
 o SetMaximum
  public void SetMaximum(int num)
Sets the maximum value for the slider.
Parameters:
num - The new maximum (passed as an integer).
 o SetMinimum
  public void SetMinimum(double num)
Sets the minimum value for the slider.
Parameters:
num - The new minimum (passed as a double).
 o SetMinimum
  public void SetMinimum(int num)
Sets the minimum value for the slider.
Parameters:
num - The new minimum (passed as an integer).
 o SetValue
  public void SetValue(double 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 (passed as a double).
 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 (passed as an integer).
 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 GetValue
  public double GetValue()
Returns the current value for the slider.
Returns:
The current value for the slider.
 o SetBackgroundColor
  public void SetBackgroundColor(Color color)
Sets the background color for the slider. The "background" is the area outside of the bar.
Parameters:
color - The new background 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 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 SetSlashColor
  public void SetSlashColor(Color color)
Sets the slash color for the slider. The "slash" is the little vertical line on the thumb.
Parameters:
color - The new slash color.
 o SetTextColor
  public void SetTextColor(Color color)
Sets the color for the slider`s text.
Parameters:
color - The new text color.
 o SetFont
  public void SetFont(Font font)
Sets the font for the slider`s text.
Parameters:
font - The new font.
 o paint
  public void paint(Graphics g)
An internal method used to handle repaint events.
Overrides:
paint in class Canvas
 o mouseDown
  public boolean mouseDown(Event e,
                           int x,
                           int y)
An internal method used to handle mouse down events.
Overrides:
mouseDown in class Component
 o mouseDrag
  public boolean mouseDrag(Event e,
                           int x,
                           int y)
An internal method used to handle mouse drag events.
Overrides:
mouseDrag in class Component
 o mouseUp
  public boolean mouseUp(Event e,
                         int x,
                         int y)
An internal method used to handle mouse up events.
Overrides:
mouseUp in class Component
 o reshape
  public void reshape(int x,
                      int y,
                      int width,
                      int height)
An internal method used to handle resizing.
Overrides:
reshape in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index