com.jmex.bui
Class BSlider

java.lang.Object
  extended by com.jmex.bui.BComponent
      extended by com.jmex.bui.BSlider
All Implemented Interfaces:
BConstants

public class BSlider
extends BComponent
implements BConstants

Displays a track with a little frob somewhere along its length that allows a user to select a smoothly varying value between two bounds.


Field Summary
protected  BIcon[] _frobs
           
protected  BoundedRangeModel _model
           
protected  int _orient
           
 
Fields inherited from class com.jmex.bui.BComponent
_alpha, _backgrounds, _bbuf, _borders, _colors, _cursor, _enabled, _height, _hover, _insets, _listeners, _parent, _preferredSize, _properties, _styleClass, _tipmouse, _tipStyle, _tiptext, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES
 
Fields inherited from interface com.jmex.bui.BConstants
BOTTOM, CENTER, DEFAULT_SIZE, DEFAULT_SPACING, GLOW, HORIZONTAL, LEFT, NORMAL, OUTLINE, OVERLAPPING, PLAIN, RIGHT, SHADOW, TOP, VERTICAL
 
Constructor Summary
BSlider(int orient, BoundedRangeModel model)
          Creates a slider with the specified orientation and range model.
BSlider(int orient, int min, int max, int value)
          Creates a slider with the specified orientation, range and value.
 
Method Summary
protected  Dimension computePreferredSize(int whint, int hhint)
          Computes and returns a preferred size for this component.
protected  void configureStyle(BStyleSheet style)
          Instructs this component to fetch its style configuration from the supplied style sheet.
 boolean dispatchEvent(BEvent event)
          Instructs this component to process the supplied event.
protected  String getDefaultStyleClass()
          Returns the default stylesheet class to be used for all instances of this component.
protected  BIcon getFrob()
           
 BoundedRangeModel getModel()
          Returns a reference to the slider's range model.
protected  void renderComponent(Renderer renderer)
          Renders any custom bits for this component.
protected  void updateValue(int mx, int my)
           
protected  void wasAdded()
          This method is called when we are added to a hierarchy that is connected to a top-level window (at which point we can rely on having a look and feel and can set ourselves up).
protected  void wasRemoved()
          This method is called when we are removed from a hierarchy that is connected to a top-level window.
 
Methods inherited from class com.jmex.bui.BComponent
acceptsFocus, addListener, applyDefaultStates, boundsToString, changeCursor, createTooltipComponent, emitEvent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getCursor, getFocusTarget, getHeight, getHitComponent, getInsets, getNextFocus, getParent, getPreferredSize, getPreviousFocus, getProperty, getState, getStateCount, getStatePseudoClass, getStyleClass, getTooltipText, getWidth, getWindow, getX, getY, hasFocus, intersectScissorBox, invalidate, isAdded, isEnabled, isShowing, isTooltipRelativeToMouse, isValid, isVisible, layout, removeAllListeners, removeListener, render, renderBackground, renderBorder, requestFocus, restoreScissorState, setAlpha, setBackground, setBounds, setCursor, setEnabled, setLocation, setParent, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleClass, setTooltipRelativeToMouse, setTooltipText, setVisible, stateDidChange, updateCursor, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_orient

protected int _orient

_model

protected BoundedRangeModel _model

_frobs

protected BIcon[] _frobs
Constructor Detail

BSlider

public BSlider(int orient,
               int min,
               int max,
               int value)
Creates a slider with the specified orientation, range and value.

Parameters:
orient - either BConstants.HORIZONTAL or BConstants.VERTICAL.

BSlider

public BSlider(int orient,
               BoundedRangeModel model)
Creates a slider with the specified orientation and range model. Note that the extent must be set to zero.

Parameters:
orient - either BConstants.HORIZONTAL or BConstants.VERTICAL.
Method Detail

getModel

public BoundedRangeModel getModel()
Returns a reference to the slider's range model.


getDefaultStyleClass

protected String getDefaultStyleClass()
Description copied from class: BComponent
Returns the default stylesheet class to be used for all instances of this component. Derived classes will likely want to override this method and set up a default class for their type of component.

Overrides:
getDefaultStyleClass in class BComponent

configureStyle

protected void configureStyle(BStyleSheet style)
Description copied from class: BComponent
Instructs this component to fetch its style configuration from the supplied style sheet. This method is called when a component is added to the interface hierarchy.

Overrides:
configureStyle in class BComponent

wasAdded

protected void wasAdded()
Description copied from class: BComponent
This method is called when we are added to a hierarchy that is connected to a top-level window (at which point we can rely on having a look and feel and can set ourselves up).

Overrides:
wasAdded in class BComponent

wasRemoved

protected void wasRemoved()
Description copied from class: BComponent
This method is called when we are removed from a hierarchy that is connected to a top-level window. If we wish to clean up after things done in BComponent.wasAdded(), this is a fine place to do so.

Overrides:
wasRemoved in class BComponent

computePreferredSize

protected Dimension computePreferredSize(int whint,
                                         int hhint)
Description copied from class: BComponent
Computes and returns a preferred size for this component. This method is called if no overriding preferred size has been supplied.

Overrides:
computePreferredSize in class BComponent
Returns:
the computed preferred size of this component in a newly created Dimension instance which will be adopted (and modified) by the caller.

dispatchEvent

public boolean dispatchEvent(BEvent event)
Description copied from class: BComponent
Instructs this component to process the supplied event. If the event is not processed, it will be passed up to its parent component for processing. Derived classes should thus only call super.dispatchEvent for events that they did not "consume".

Overrides:
dispatchEvent in class BComponent
Returns:
true if this event was consumed, false if not.

renderComponent

protected void renderComponent(Renderer renderer)
Description copied from class: BComponent
Renders any custom bits for this component. This is called with the graphics context translated to (0, 0) relative to this component.

Overrides:
renderComponent in class BComponent

updateValue

protected void updateValue(int mx,
                           int my)

getFrob

protected BIcon getFrob()


Copyright © 2008 Michael Bayne. All Rights Reserved.