## visad.util
Class VisADSlider

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JPanel
                      visad.util.VisADSlider

All Implemented Interfaces:
  Accessible, ChangeListener, ControlListener, EventListener, ImageObserver, MenuContainer, ScalarMapListener, Serializable

public class VisADSlider
extends JPanel
implements ChangeListener, ControlListener, ScalarMapListener

VisADSlider combines a JSlider and a JLabel and links them to either a Real (via a DataReference) or a ScalarMap that maps to Display.SelectValue. Changes in the slider will reflect the Real or ScalarMap linked to it. If no bounds are specified, they will be detected from the ScalarMap and the slider will auto-scale. Note that a slider linked to a Real cannot auto-scale, because it has no way to detect the bounds.
`BoxLayout` doesn't handle a mixture of the standard center-aligned widgets and VisADSliders, which are left-aligned by default. If you have problems with widgets being too wide, you may want to change the other widgets in the `JPanel` to align on the left (e.g. `widget.setAlignmentX(BoxLayout.LEFT_ALIGNMENT)`)

See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JPanel
`JPanel.AccessibleJPanel`

Nested classes inherited from class javax.swing.JComponent
`JComponent.AccessibleJComponent`

Nested classes inherited from class java.awt.Container
`Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy`

Field Summary

Fields inherited from class javax.swing.JComponent
`accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

Fields inherited from class java.awt.Container
``

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
`VisADSlider(DataReference ref, float min, float max)` construct a VisADSlider from an existing Real pointed to by r, with minimum and maximum bounds min and max
`VisADSlider(DataReference ref, float min, float max, float start, RealType rt, String n)` construct a VisADSlider by creating a Real and linking it to r, using RealType rt and name n, with minimum and maximum bounds min and max, and starting value start
`VisADSlider(ScalarMap smap)` construct a VisADSlider from a ScalarMap that maps to Display.SelectValue, with auto-scaling minimum and maximum bounds, non-integral values, and a statically sized label.
`VisADSlider(ScalarMap smap, boolean integralTicks)` construct a VisADSlider from a ScalarMap that maps to Display.SelectValue, with auto-scaling minimum and maximum bounds, either integer or floating-point values, depending on the setting of `integralTicks`, and a statically sized label.
`VisADSlider(ScalarMap smap, boolean integralTicks, boolean dynamicLabelWidth)` construct a VisADSlider from a ScalarMap that maps to Display.SelectValue, with auto-scaling minimum and maximum bounds, either integer or floating-point values (depending on the setting of `integralTicks`, and either a static or dynamically sized label (depending on the setting of `dynamicLabelWidth`.
`VisADSlider(ScalarMap smap, float min, float max)` construct a VisADSlider from a ScalarMap that maps to Display.SelectValue, with minimum and maximum bounds min and max, no auto-scaling, non-integer values, and a static label width.
`VisADSlider(String n, int lo, int hi, int st, double scale, DataReference ref, RealType rt)` JSlider values range between `low` and `hi` (with initial value `st`) and are multiplied by `scale` to create Real values of RealType `rt` referenced by `ref`.
`VisADSlider(String n, int lo, int hi, int st, double scale, DataReference ref, RealType rt, boolean dynamicLabelWidth)` JSlider values range between `low` and `hi` (with initial value `st`) and are multiplied by `scale` to create Real values of RealType `rt` referenced by `ref`.

Method Summary
`void` `controlChanged(ControlEvent e)` Update slider when value of linked ValueControl changes
`void` `controlChanged(ScalarMapControlEvent evt)` ScalarMapListener method used to detect new control.
`void` `hardcodeSizePercent(int percent)` Hardcode the preferred size of the slider after increasing the current width by the specified percentage (or decreasing it if `percent` is negative.) This method is primarily useful to keep changes in the label (of a VisADSlider with `dynamicLabelWidth` set to `true</t>) from causing the rest of the window to be redrawn.`
`void` `mapChanged(ScalarMapEvent e)` used for auto-scaling the minimum and maximum
`void` `stateChanged(ChangeEvent e)` called when slider is adjusted

Methods inherited from class javax.swing.JPanel
`getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

Methods inherited from class javax.swing.JComponent

`addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

Methods inherited from class java.awt.Container

`add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree`

Methods inherited from class java.awt.Component

`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### VisADSlider

    public VisADSlider(String n,
                       int lo,
                       int hi,
                       int st,
                       double scale,
                       DataReference ref,
                       RealType rt)
                throws VisADException,
                       RemoteException

  JSlider values range between `low` and `hi` (with initial value `st`) and are multiplied by `scale` to create Real values of RealType `rt` referenced by `ref`.

### VisADSlider

    public VisADSlider(String n,
                       int lo,
                       int hi,
                       int st,
                       double scale,
                       DataReference ref,
                       RealType rt,
                       boolean dynamicLabelWidth)
                throws VisADException,
                       RemoteException

  JSlider values range between `low` and `hi` (with initial value `st`) and are multiplied by `scale` to create Real values of RealType `rt` referenced by `ref`. The slider label has a dynamically sized width if `dynamicLabelWidth` is `true`.

### VisADSlider

    public VisADSlider(ScalarMap smap)
                throws VisADException,
                       RemoteException

  construct a VisADSlider from a ScalarMap that maps to Display.SelectValue, with auto-scaling minimum and maximum bounds, non-integral values, and a statically sized label.

### VisADSlider

    public VisADSlider(ScalarMap smap,
                       boolean integralTicks)
                throws VisADException,
                       RemoteException

  construct a VisADSlider from a ScalarMap that maps to Display.SelectValue, with auto-scaling minimum and maximum bounds, either integer or floating-point values, depending on the setting of `integralTicks`, and a statically sized label.

### VisADSlider

    public VisADSlider(ScalarMap smap,
                       boolean integralTicks,
                       boolean dynamicLabelWidth)
                throws VisADException,
                       RemoteException

  construct a VisADSlider from a ScalarMap that maps to Display.SelectValue, with auto-scaling minimum and maximum bounds, either integer or floating-point values (depending on the setting of `integralTicks`, and either a static or dynamically sized label (depending on the setting of `dynamicLabelWidth`.

### VisADSlider

    public VisADSlider(ScalarMap smap,
                       float min,
                       float max)
                throws VisADException,
                       RemoteException

  construct a VisADSlider from a ScalarMap that maps to Display.SelectValue, with minimum and maximum bounds min and max, no auto-scaling, non-integer values, and a static label width.

### VisADSlider

    public VisADSlider(DataReference ref,
                       float min,
                       float max,
                       float start,
                       RealType rt,
                       String n)
                throws VisADException,
                       RemoteException

  construct a VisADSlider by creating a Real and linking it to r, using RealType rt and name n, with minimum and maximum bounds min and max, and starting value start

### VisADSlider

    public VisADSlider(DataReference ref,
                       float min,
                       float max)
                throws VisADException,
                       RemoteException

  construct a VisADSlider from an existing Real pointed to by r, with minimum and maximum bounds min and max

Method Detail

### hardcodeSizePercent

    public void hardcodeSizePercent(int percent)

  Hardcode the preferred size of the slider after increasing the current width by the specified percentage (or decreasing it if `percent` is negative.)
  This method is primarily useful to keep changes in the label (of a VisADSlider with `dynamicLabelWidth` set to `true</t>) from causing the rest of the window to be redrawn.

  `
  Parameters:
    `percent` - percent of current size to use for hardcoded size. (e.g. to keep the current size, specify `100`; to increase the size a bit, specify `115`, to decrease it a bit, specify `85`, etc.)

### stateChanged

    public void stateChanged(ChangeEvent e)

  called when slider is adjusted

  Specified by:
    `stateChanged` in interface `ChangeListener`

### mapChanged

    public void mapChanged(ScalarMapEvent e)

  used for auto-scaling the minimum and maximum

  Specified by:
    `mapChanged` in interface `ScalarMapListener`
  Parameters:
    `e` - the event

### controlChanged

    public void controlChanged(ScalarMapControlEvent evt)

  ScalarMapListener method used to detect new control.

  Specified by:
    `controlChanged` in interface `ScalarMapListener`
  Parameters:
    `evt` - the event

### controlChanged

    public void controlChanged(ControlEvent e)
                        throws VisADException,
                               RemoteException

  Update slider when value of linked ValueControl changes

  Specified by:
    `controlChanged` in interface `ControlListener`
  Throws:
    `VisADException`
    `RemoteException`