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
- implements MouseListener, MouseMotionListener
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:
- $Revision: 1.1.1.1 $, $Date: 1999/11/15 20:37:48 $.
- Authors:
- Adam Doppelt,
- with some significant modifications by
- Benjamin "Quincy" Cabell V,
- Besiex Software.
- Daren Stotler.
-
BUFFER
-
-
DEFAULT_DOUBLE_MAX
-
-
DEFAULT_DOUBLE_MIN
-
-
DEFAULT_HEIGHT
-
-
DEFAULT_WIDTH
-
-
MIN_HEIGHT
-
-
MIN_WIDTH
-
-
TEXT_BUFFER
-
-
textHeight_
-
-
THUMB_SIZE
-
-
MightySlider()
- Constructs a slider.
-
getMinimumSize()
- 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 getMinimumSize() method), or if
the user has not resized this component, the default height and width are used.
-
getPreferredSize()
- The preferred size for this slider component is the same as its minimum size.
-
GetValue()
- Returns the current value for the slider.
-
Motion()
- This method is called when the "thumb" of the slider is dragged by
the user.
-
mouseClicked(MouseEvent)
-
-
mouseDragged(MouseEvent)
- And the MouseMotionListener methods.
-
mouseEntered(MouseEvent)
-
-
mouseExited(MouseEvent)
-
-
mouseMoved(MouseEvent)
-
-
mousePressed(MouseEvent)
- Here are the MouseListener methods.
-
mouseReleased(MouseEvent)
- An internal method used to handle mouse up events.
-
paint(Graphics)
- An internal method used to handle repaint events.
-
Release()
- This method is called when the "thumb" of the slider is released
after being dragged.
-
SetBackgroundColor(Color)
- Sets the background color for the slider.
-
SetBarColor(Color)
- Sets the color for the slider's bar.
-
setBounds(int, int, int, int)
- An internal method used to handle resizing.
-
SetDoubleMode(boolean)
-
-
SetFont(Font)
- Sets the font for the slider`s text.
-
SetHeight(int)
- Sets the height of the slider.
-
SetMaximum(double)
- Sets the maximum value for the slider.
-
SetMaximum(int)
- Sets the maximum value for the slider.
-
SetMinimum(double)
- Sets the minimum value for the slider.
-
SetMinimum(int)
- Sets the minimum value for the slider.
-
SetSlashColor(Color)
- Sets the slash color for the slider.
-
SetTextColor(Color)
- Sets the color for the slider`s text.
-
SetThumbColor(Color)
- Sets the color for the slider's thumb.
-
SetValue(double)
- Sets the current value for the slider.
-
SetValue(int)
- Sets the current value for the slider.
-
SetWidth(int)
- Sets the width of the slider.
THUMB_SIZE
protected static final int THUMB_SIZE
BUFFER
protected static final int BUFFER
textHeight_
protected int textHeight_
TEXT_BUFFER
protected static final int TEXT_BUFFER
DEFAULT_WIDTH
protected static final int DEFAULT_WIDTH
DEFAULT_HEIGHT
protected static final int DEFAULT_HEIGHT
MIN_WIDTH
protected static final int MIN_WIDTH
MIN_HEIGHT
protected static final int MIN_HEIGHT
DEFAULT_DOUBLE_MIN
protected static final double DEFAULT_DOUBLE_MIN
DEFAULT_DOUBLE_MAX
protected static final double DEFAULT_DOUBLE_MAX
MightySlider
public MightySlider()
- Constructs a slider.
SetDoubleMode
public void SetDoubleMode(boolean theMode)
getPreferredSize
public Dimension getPreferredSize()
- The preferred size for this slider component is the same as its minimum size.
- Overrides:
- getPreferredSize in class Component
getMinimumSize
public Dimension getMinimumSize()
- 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 getMinimumSize() 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:
- getMinimumSize in class Component
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.
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.
SetMaximum
public void SetMaximum(double num)
- Sets the maximum value for the slider.
- Parameters:
- num - The new maximum (passed as a double).
SetMaximum
public void SetMaximum(int num)
- Sets the maximum value for the slider.
- Parameters:
- num - The new maximum (passed as an integer).
SetMinimum
public void SetMinimum(double num)
- Sets the minimum value for the slider.
- Parameters:
- num - The new minimum (passed as a double).
SetMinimum
public void SetMinimum(int num)
- Sets the minimum value for the slider.
- Parameters:
- num - The new minimum (passed as an integer).
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).
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).
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.
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.
GetValue
public double GetValue()
- Returns the current value for the slider.
- Returns:
- The current value for the slider.
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.
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.
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.
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.
SetTextColor
public void SetTextColor(Color color)
- Sets the color for the slider`s text.
- Parameters:
- color - The new text color.
SetFont
public void SetFont(Font font)
- Sets the font for the slider`s text.
- Parameters:
- font - The new font.
paint
public void paint(Graphics g)
- An internal method used to handle repaint events.
- Overrides:
- paint in class Canvas
mousePressed
public void mousePressed(MouseEvent evt)
- Here are the MouseListener methods. Only two are nontrivial.
An internal method used to handle mouse down events.
mouseReleased
public void mouseReleased(MouseEvent evt)
- An internal method used to handle mouse up events.
mouseClicked
public void mouseClicked(MouseEvent evt)
mouseEntered
public void mouseEntered(MouseEvent evt)
mouseExited
public void mouseExited(MouseEvent evt)
mouseDragged
public void mouseDragged(MouseEvent evt)
- And the MouseMotionListener methods. Only need the drag one.
An internal method used to handle mouse drag events.
mouseMoved
public void mouseMoved(MouseEvent evt)
setBounds
public void setBounds(int x,
int y,
int width,
int height)
- An internal method used to handle resizing.
- Overrides:
- setBounds in class Component
All Packages Class Hierarchy This Package Previous Next Index