Class Slider
All Packages Class Hierarchy This Package Previous Next Index
Class Slider
public class netscape.application.Slider
extends netscape.application.View
implements netscape.application.Target,
netscape.application.FormElement
{
/* Fields
*/
public final static String DECREASE_VALUE;
public final static String INCREASE_VALUE;
/* Constructors
*/
public Slider();
public Slider(Rect);
public Slider(int, int, int, int);
/* Methods
*/
public Color backgroundColor();
public Border border();
public boolean canBecomeSelectedView();
public String command();
public void decode(Decoder);
public void describeClassInfo(ClassInfo);
public void didSizeBy(int, int);
public void drawView(Graphics);
public void drawViewGroove(Graphics);
public void drawViewKnob(Graphics);
public void encode(Encoder);
public String formElementText();
public int grooveHeight();
public Image image();
public int imageDisplayStyle();
public int incrementResolution();
public boolean isEnabled();
public int knobHeight();
public Image knobImage();
public Rect knobRect();
public int knobWidth();
public int maxValue();
public Size minSize();
public int minValue();
public boolean mouseDown(MouseEvent);
public void mouseDragged(MouseEvent);
public void performCommand(String, Object);
public void sendCommand();
public void setBackgroundColor(Color);
public void setBorder(Border);
public void setCommand(String);
public void setEnabled(boolean);
public void setGrooveHeight(int);
public void setImage(Image);
public void setImageDisplayStyle(int);
public void setIncrementResolution(int);
public void setKnobHeight(int);
public void setKnobImage(Image);
public void setLimits(int, int);
public void setTarget(Target);
public void setValue(int);
public Target target();
public int value();
}
View subclass that implements a "slider," an analog control device that
allows the user to drag a knob to select the Slider's value. As the
Slider changes its value, it sends a command to its Target.
Fields
INCREASE_VALUE
public final static String INCREASE_VALUE
- Increase the slider value
DECREASE_VALUE
public final static String DECREASE_VALUE
- Decrease the slider value
Constructors
.Slider
public Slider()
- Constructs a Slider with origin (0, 0) and zero
width and height.
.Slider
public Slider(Rect rect)
- Constructs a Slider with bounds rect.
.Slider
public Slider(int x,
int y,
int width,
int height)
- Constructs a Slider with bounds
(x, y, width, height).
Methods
public Size minSize()
- Overridden to return the Slider's minimum size.
- Overrides:
- minSize in class View
public void setLimits(int minValue,
int maxValue)
- Sets the Slider's minimum and maximum values. Modifies the Slider's
current value to fit within this new range (if outside of the range).
public int minValue()
- Returns the Slider's minimum value.
- See Also:
- setLimits
public int maxValue()
- Returns the Slider's maximum value.
- See Also:
- setLimits
public void setKnobImage(Image anImage)
- Sets the Image displayed by the Slider as its "knob." If set,
the Slider will display this Image rather than draw a bezeled
knob.
public Image knobImage()
- Returns the Image displayed by the Slider as its "knob."
- See Also:
- setKnobImage
public void setBackgroundColor(Color aColor)
- Sets the Color the Slider displays within its groove if it has no
image.
public Color backgroundColor()
- Returns the Color the Slider displays within its groove.
- See Also:
- setBackgroundColor
public void setImage(Image anImage)
- Sets the Image the Slider displays within its groove.
public Image image()
- Returns the Image the Slider displays within its groove.
- See Also:
- setImage
public void setImageDisplayStyle(int aStyle)
- Tells the Slider how to display its Image (Image.CENTERED,
Image.TILED, or Image.SCALED).
- See Also:
- setImage
public int imageDisplayStyle()
- Returns the style the Slider uses to display its Image.
- See Also:
- setImageDisplayStyle
public void setTarget(Target aTarget)
- Sets the Slider's Target, the object the Slider notifies when the
user changes its value.
- See Also:
- Target
public Target target()
- Returns the Slider's Target.
- See Also:
- setTarget
public void setCommand(String command)
- Sets the command the Slider sends to its Target.
- See Also:
- setTarget
public String command()
- Returns the command the Slider sends to its Target.
- See Also:
- setCommand
public void sendCommand()
- Called by the Slider to send its command to its Target.
- See Also:
- setTarget
public void setEnabled(boolean enabled)
- Sets the Slider's "enabled" state and then calls the Slider's
draw() method to redraw it. A disabled Slider does not
respond to mouse clicks or drags.
public boolean isEnabled()
- Returns true is the Slider is enabled.
- See Also:
- setEnabled
public int knobWidth()
- Returns the width of the Slider's knob. Override when subclassing
if you want to draw a special knob.
public void setKnobHeight(int anInt)
- Sets the Slider's knob height.
public int knobHeight()
- Returns the Slider's knob height.
- See Also:
- setKnobHeight
public void setGrooveHeight(int anInt)
- Sets the Slider's groove height.
public int grooveHeight()
- Returns the Slider's groove height.
- See Also:
- setKnobHeight
public void setBorder(Border newBorder)
- Sets the Border the Slider draws around its groove.
public Border border()
- Returns the Border the Slider draws around its groove.
- See Also:
- setBorder
public void setValue(int aValue)
- Sets the Slider's value and redraws the Slider. If less than
minValue() or greater than maxValue(), does nothing.
public int value()
- Returns the Slider's value.
- See Also:
- setValue
public void drawViewGroove(Graphics g)
- Draws the Slider's groove, which includes its Border and contents.
You never call this method directly, but should override it to
implement custom groove drawing.
public Rect knobRect()
- Returns a Rect containing the Slider's knob.
public void drawViewKnob(Graphics g)
- Draws the Slider's knob. You never call this method directly, but
should override it to implement custom knob drawing.
public void drawView(Graphics g)
- Draws the Slider. Calls drawViewGroove() and
drawViewKnob().
- Overrides:
- drawView in class View
- See Also:
- drawViewGroove, drawViewKnob
public void didSizeBy(int deltaWidth,
int deltaHeight)
- Overridden to reposition the Slider's knob when resized.
- Overrides:
- didSizeBy in class View
public boolean mouseDown(MouseEvent event)
- Overridden to implement knob dragging and send the Slider's command
to its Target.
- Overrides:
- mouseDown in class View
- See Also:
- sendCommand
public void mouseDragged(MouseEvent event)
- Overridden to implement knob dragging and send the Slider's command
to its Target.
- Overrides:
- mouseDragged in class View
- See Also:
- sendCommand
public void describeClassInfo(ClassInfo info)
- Describes the Slider class' information.
- Overrides:
- describeClassInfo in class View
- See Also:
- describeClassInfo
public void encode(Encoder encoder) throws CodingException
- Encodes the Slider instance.
- Overrides:
- encode in class View
- See Also:
- encode
public void decode(Decoder decoder) throws CodingException
- Decodes the Slider instance.
- Overrides:
- decode in class View
- See Also:
- decode
public boolean canBecomeSelectedView()
- Overriden to return true.
- Overrides:
- canBecomeSelectedView in class View
public void performCommand(String command,
Object data)
- Overriden to increase / decrease the value
public int incrementResolution()
- Return the increment used by keyboard UI
The default increment is 20. This means that the user will have
to press a key 20 times to go from the minValue to the maxValue.
- See Also:
- setIncrementResolution
public void setIncrementResolution(int aValue)
- Set the value increment
public String formElementText()
- Implementation of the FormElement interface
All Packages Class Hierarchy This Package Previous Next Index
Copyright © 1997 Netscape Communications Corporation. All rights reserved
Please send any comments or corrections to ifcfeedback@netscape.com
HTML generated on 21 Oct 1997