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;  *Beta API*
    public final static String INCREASE_VALUE;  *Beta API*

    /* Constructors
     */
    public Slider();
    public Slider(Rect);
    public Slider(int, int, int, int);

    /* Methods
     */
    public Color backgroundColor();
    public Border border();
    public boolean canBecomeSelectedView(); *Beta API*
    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(); *Beta API*
    public int grooveHeight();
    public Image image();
    public int imageDisplayStyle();
    public int incrementResolution(); *Beta API*
    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); *Beta API*
    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

minSize

  public Size minSize()
Overridden to return the Slider's minimum size.
Overrides:
minSize in class View

setLimits

  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).

minValue

  public int minValue()
Returns the Slider's minimum value.
See Also:
setLimits

maxValue

  public int maxValue()
Returns the Slider's maximum value.
See Also:
setLimits

setKnobImage

  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.

knobImage

  public Image knobImage()
Returns the Image displayed by the Slider as its "knob."
See Also:
setKnobImage

setBackgroundColor

  public void setBackgroundColor(Color aColor)
Sets the Color the Slider displays within its groove if it has no image.

backgroundColor

  public Color backgroundColor()
Returns the Color the Slider displays within its groove.
See Also:
setBackgroundColor

setImage

  public void setImage(Image anImage)
Sets the Image the Slider displays within its groove.

image

  public Image image()
Returns the Image the Slider displays within its groove.
See Also:
setImage

setImageDisplayStyle

  public void setImageDisplayStyle(int aStyle)
Tells the Slider how to display its Image (Image.CENTERED, Image.TILED, or Image.SCALED).
See Also:
setImage

imageDisplayStyle

  public int imageDisplayStyle()
Returns the style the Slider uses to display its Image.
See Also:
setImageDisplayStyle

setTarget

  public void setTarget(Target aTarget)
Sets the Slider's Target, the object the Slider notifies when the user changes its value.
See Also:
Target

target

  public Target target()
Returns the Slider's Target.
See Also:
setTarget

setCommand

  public void setCommand(String command)
Sets the command the Slider sends to its Target.
See Also:
setTarget

command

  public String command()
Returns the command the Slider sends to its Target.
See Also:
setCommand

sendCommand

  public void sendCommand()
Called by the Slider to send its command to its Target.
See Also:
setTarget

setEnabled

  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.

isEnabled

  public boolean isEnabled()
Returns true is the Slider is enabled.
See Also:
setEnabled

knobWidth

  public int knobWidth()
Returns the width of the Slider's knob. Override when subclassing if you want to draw a special knob.

setKnobHeight

  public void setKnobHeight(int anInt)
Sets the Slider's knob height.

knobHeight

  public int knobHeight()
Returns the Slider's knob height.
See Also:
setKnobHeight

setGrooveHeight

  public void setGrooveHeight(int anInt)
Sets the Slider's groove height.

grooveHeight

  public int grooveHeight()
Returns the Slider's groove height.
See Also:
setKnobHeight

setBorder

  public void setBorder(Border newBorder)
Sets the Border the Slider draws around its groove.

border

  public Border border()
Returns the Border the Slider draws around its groove.
See Also:
setBorder

setValue

  public void setValue(int aValue)
Sets the Slider's value and redraws the Slider. If less than minValue() or greater than maxValue(), does nothing.

value

  public int value()
Returns the Slider's value.
See Also:
setValue

drawViewGroove

  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.

knobRect

  public Rect knobRect()
Returns a Rect containing the Slider's knob.

drawViewKnob

  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.

drawView

  public void drawView(Graphics g)
Draws the Slider. Calls drawViewGroove() and drawViewKnob().
Overrides:
drawView in class View
See Also:
drawViewGroove, drawViewKnob

didSizeBy

  public void didSizeBy(int deltaWidth,
                        int deltaHeight)
Overridden to reposition the Slider's knob when resized.
Overrides:
didSizeBy in class View

mouseDown

  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

mouseDragged

  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

describeClassInfo

  public void describeClassInfo(ClassInfo info)
Describes the Slider class' information.
Overrides:
describeClassInfo in class View
See Also:
describeClassInfo

encode

  public void encode(Encoder encoder) throws CodingException
Encodes the Slider instance.
Overrides:
encode in class View
See Also:
encode

decode

  public void decode(Decoder decoder) throws CodingException
Decodes the Slider instance.
Overrides:
decode in class View
See Also:
decode

canBecomeSelectedView

  public boolean canBecomeSelectedView() *Beta API* 
Overriden to return true.
Overrides:
canBecomeSelectedView in class View

performCommand

  public void performCommand(String command,
                             Object data)
Overriden to increase / decrease the value

incrementResolution

  public int incrementResolution() *Beta API* 
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

setIncrementResolution

  public void setIncrementResolution(int aValue) *Beta API* 
Set the value increment

formElementText

  public String formElementText() *Beta API* 
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 Apr 1997