nl.skybound.awt
Class FloatScrollbar

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Scrollbar
              |
              +--nl.skybound.awt.FloatScrollbar
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.Adjustable, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class FloatScrollbar
extends java.awt.Scrollbar

Descendent of Scrollbar that supports floats as well as ints. To get float values, call the appropriate get...AsFloat() methods. To set float values, call the overloaded Scrollbar methods that accept float values as parameters (make sure you're actually using floats and not ints or else you'll be calling the standard Scrollbar methods).

Version:
1.00
Author:
Craig Manley
See Also:
Scrollbar, Serialized Form

Inner classes inherited from class java.awt.Scrollbar
java.awt.Scrollbar.AccessibleAWTScrollBar
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Fields inherited from class java.awt.Scrollbar
HORIZONTAL, VERTICAL
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
FloatScrollbar()
           
FloatScrollbar(int orientation, float value, float visible, float minimum, float maximum, byte decimals)
          Constructs a new scroll bar with the specified orientation, initial value, page size, minimum and maximum values, and decimal precision.
 
Method Summary
 float getBlockIncrementAsFloat()
          Gets the block increment of this scroll bar.
 java.lang.Number getCurrentAccessibleValue()
          Get the accessible value of this object.
 byte getDecimals()
          Gets the decimal precision of this scroll bar.
 java.lang.Number getMaximumAccessibleValue()
          Get the maximum accessible value of this object.
 float getMaximumAsFloat()
          Gets the maximum value of this scroll bar.
 java.lang.Number getMinimumAccessibleValue()
          Get the minimum accessible value of this object.
 float getMinimumAsFloat()
          Gets the minimum value of this scroll bar.
 float getUnitIncrementAsFloat()
          Gets the unit increment for this scrollbar.
 float getValueAsFloat()
          Gets the current float value of this scroll bar.
 float getVisibleAmountAsFloat()
          Gets the visible amount of this scroll bar.
 void setBlockIncrement(float v)
          Sets the block increment for this scroll bar.
 boolean setCurrentAccessibleValue(java.lang.Number n)
          Set the value of this object as a Number.
 void setDecimals(byte newValue)
          Sets the decimal precision of this scroll bar to the specified byte value.
 void setMaximum(float newMaximum)
          Sets the maximum value of this scroll bar.
 void setMinimum(float newMinimum)
          Sets the minimum value of this scroll bar.
 void setUnitIncrement(float v)
          Sets the unit increment for this scroll bar.
 void setValue(float newValue)
          Sets the value of this scroll bar to the specified float value.
 void setValues(float value, float visible, float minimum, float maximum, byte decimals)
          Sets the values of four properties for this scroll bar.
 void setVisibleAmount(float newAmount)
          Sets the visible amount of this scroll bar.
 
Methods inherited from class java.awt.Scrollbar
addAdjustmentListener, addNotify, getAccessibleContext, getBlockIncrement, getLineIncrement, getListeners, getMaximum, getMinimum, getOrientation, getPageIncrement, getUnitIncrement, getValue, getVisible, getVisibleAmount, paramString, processAdjustmentEvent, processEvent, removeAdjustmentListener, setBlockIncrement, setLineIncrement, setMaximum, setMinimum, setOrientation, setPageIncrement, setUnitIncrement, setValue, setValues, setVisibleAmount
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FloatScrollbar

public FloatScrollbar()

FloatScrollbar

public FloatScrollbar(int orientation,
                      float value,
                      float visible,
                      float minimum,
                      float maximum,
                      byte decimals)
Constructs a new scroll bar with the specified orientation, initial value, page size, minimum and maximum values, and decimal precision.

The decimals argument must be >= 0 and <= 9. If you're using 0, consider using the standard Scrollbar instead.

Parameters:
orientation - indicates the orientation of the scroll bar.
value - the initial value of the scroll bar.
visible - the size of the scroll bar's bubble, representing the visible portion; the scroll bar uses this value when paging up or down by a page.
minimum - the minimum value of the scroll bar.
maximum - the maximum value of the scroll bar.
decimals - the number of decimal digits after the decimal seperator (precision). *
See Also:
Scrollbar
Method Detail

getValueAsFloat

public float getValueAsFloat()
Gets the current float value of this scroll bar.
Returns:
the current value of this scroll bar.
See Also:
getMinimumAsFloat(), getMaximumAsFloat()

setValue

public void setValue(float newValue)
Sets the value of this scroll bar to the specified float value.

If the value supplied is less than the current minimum or greater than the current maximum, then one of those values is substituted, as appropriate.

Normally, a program should change a scroll bar's value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.

Parameters:
newValue - the new value of the scroll bar.
See Also:
setValues(float, float, float, float, byte), getValueAsFloat(), getMinimumAsFloat(), getMaximumAsFloat()

getMinimumAsFloat

public float getMinimumAsFloat()
Gets the minimum value of this scroll bar.
Returns:
the minimum value of this scroll bar.
See Also:
getValueAsFloat(), getMaximumAsFloat()

setMinimum

public void setMinimum(float newMinimum)
Sets the minimum value of this scroll bar.

Normally, a program should change a scroll bar's minimum value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.

Parameters:
newMinimum - the new minimum value for this scroll bar.
Since:
JDK1.1
See Also:
setValues(float, float, float, float, byte), setMaximum(float)

getMaximumAsFloat

public float getMaximumAsFloat()
Gets the maximum value of this scroll bar.
Returns:
the maximum value of this scroll bar.
See Also:
getValueAsFloat(), getMinimumAsFloat()

setMaximum

public void setMaximum(float newMaximum)
Sets the maximum value of this scroll bar.

Normally, a program should change a scroll bar's maximum value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.

Parameters:
newMaximum - the new maximum value for this scroll bar.
Since:
JDK1.1
See Also:
setValues(float, float, float, float, byte), setMinimum(float)

getVisibleAmountAsFloat

public float getVisibleAmountAsFloat()
Gets the visible amount of this scroll bar.

The visible amount of a scroll bar is the range of values represented by the width of the scroll bar's bubble. It is used to determine the scroll bar's block increment.

Returns:
the visible amount of this scroll bar.
Since:
JDK1.1
See Also:
setVisibleAmount(float)

setVisibleAmount

public void setVisibleAmount(float newAmount)
Sets the visible amount of this scroll bar.

The visible amount of a scroll bar is the range of values represented by the width of the scroll bar's bubble. It is used to determine the scroll bar's block increment.

Normally, a program should change a scroll bar's value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.

Parameters:
newAmount - the amount visible per page.
Since:
JDK1.1
See Also:
getVisibleAmountAsFloat(), setValues(float, float, float, float, byte)

setUnitIncrement

public void setUnitIncrement(float v)
Sets the unit increment for this scroll bar.

The unit increment is the value that is added (subtracted) when the user activates the unit increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.

Parameters:
v - the amount by which to increment or decrement the scroll bar's value.
Since:
JDK1.1
See Also:
getUnitIncrementAsFloat()

getUnitIncrementAsFloat

public float getUnitIncrementAsFloat()
Gets the unit increment for this scrollbar.

The unit increment is the value that is added (subtracted) when the user activates the unit increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.

Returns:
the unit increment of this scroll bar.
Since:
JDK1.1
See Also:
setUnitIncrement(float)

setBlockIncrement

public void setBlockIncrement(float v)
Sets the block increment for this scroll bar.

The block increment is the value that is added (subtracted) when the user activates the block increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.

Parameters:
v - the amount by which to increment or decrement the scroll bar's value.
Since:
JDK1.1
See Also:
getBlockIncrementAsFloat()

getBlockIncrementAsFloat

public float getBlockIncrementAsFloat()
Gets the block increment of this scroll bar.

The block increment is the value that is added (subtracted) when the user activates the block increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.

Returns:
the block increment of this scroll bar.
Since:
JDK1.1
See Also:
setBlockIncrement(float)

setValues

public void setValues(float value,
                      float visible,
                      float minimum,
                      float maximum,
                      byte decimals)
Sets the values of four properties for this scroll bar.

This method simultaneously and synchronously sets the values of four scroll bar properties, assuring that the values of these properties are mutually consistent. It enforces the constraints that maximum cannot be less than minimum, and that value cannot be less than the minimum or greater than the maximum.

Parameters:
value - is the position in the current window.
visible - is the amount visible per page.
minimum - is the minimum value of the scroll bar.
maximum - is the maximum value of the scroll bar.
decimals - is the decimal precision to be used. Defaut 0 == no decimals.

setDecimals

public void setDecimals(byte newValue)
Sets the decimal precision of this scroll bar to the specified byte value.

If the value supplied is less than 0 then an IllegalArgumentException is thrown. Try to keep the value as small as possible because the higher the decimal value, the smaller the maximum possible integer value.

Parameters:
newValue - the new value of the scroll bar.
See Also:
getDecimals()

getDecimals

public byte getDecimals()
Gets the decimal precision of this scroll bar.
Returns:
the decimal precision of this scroll bar.
See Also:
setDecimals(byte)

getCurrentAccessibleValue

public java.lang.Number getCurrentAccessibleValue()
Get the accessible value of this object.
Returns:
The current value of this object.

setCurrentAccessibleValue

public boolean setCurrentAccessibleValue(java.lang.Number n)
Set the value of this object as a Number.
Returns:
True if the value was set.

getMinimumAccessibleValue

public java.lang.Number getMinimumAccessibleValue()
Get the minimum accessible value of this object.
Returns:
The minimum value of this object.

getMaximumAccessibleValue

public java.lang.Number getMaximumAccessibleValue()
Get the maximum accessible value of this object.
Returns:
The maximum value of this object.