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:
- java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener, ControlListener, ScalarMapListener
public class VisADSlider extends javax.swing.JPanel implements javax.swing.event.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.
BoxLayoutdoesn'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 theJPanelto align on the left (e.g. widget.setAlignmentX(BoxLayout.LEFT_ALIGNMENT))- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Field Summary
-
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor and Description 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 maxVisADSlider(DataReference ref, float min, float max, float start, RealType rt, java.lang.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 startVisADSlider(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(java.lang.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(java.lang.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
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidcontrolChanged(ControlEvent e)Update slider when value of linked ValueControl changesvoidcontrolChanged(ScalarMapControlEvent evt)ScalarMapListener method used to detect new control.voidhardcodeSizePercent(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) from causing the rest of the window to be redrawn.voidmapChanged(ScalarMapEvent e)used for auto-scaling the minimum and maximumvoidstateChanged(javax.swing.event.ChangeEvent e)called when slider is adjusted-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
VisADSlider
public VisADSlider(java.lang.String n, int lo, int hi, int st, double scale, DataReference ref, RealType rt) throws VisADException, java.rmi.RemoteExceptionJSlider 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.- Throws:
VisADExceptionjava.rmi.RemoteException
-
VisADSlider
public VisADSlider(java.lang.String n, int lo, int hi, int st, double scale, DataReference ref, RealType rt, boolean dynamicLabelWidth) throws VisADException, java.rmi.RemoteExceptionJSlider 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.- Throws:
VisADExceptionjava.rmi.RemoteException
-
VisADSlider
public VisADSlider(ScalarMap smap) throws VisADException, java.rmi.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.- Throws:
VisADExceptionjava.rmi.RemoteException
-
VisADSlider
public VisADSlider(ScalarMap smap, boolean integralTicks) throws VisADException, java.rmi.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.- Throws:
VisADExceptionjava.rmi.RemoteException
-
VisADSlider
public VisADSlider(ScalarMap smap, boolean integralTicks, boolean dynamicLabelWidth) throws VisADException, java.rmi.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.- Throws:
VisADExceptionjava.rmi.RemoteException
-
VisADSlider
public VisADSlider(ScalarMap smap, float min, float max) throws VisADException, java.rmi.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.- Throws:
VisADExceptionjava.rmi.RemoteException
-
VisADSlider
public VisADSlider(DataReference ref, float min, float max, float start, RealType rt, java.lang.String n) throws VisADException, java.rmi.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- Throws:
VisADExceptionjava.rmi.RemoteException
-
VisADSlider
public VisADSlider(DataReference ref, float min, float max) throws VisADException, java.rmi.RemoteException
construct a VisADSlider from an existing Real pointed to by r, with minimum and maximum bounds min and max- Throws:
VisADExceptionjava.rmi.RemoteException
-
-
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) 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(javax.swing.event.ChangeEvent e)
called when slider is adjusted- Specified by:
stateChangedin interfacejavax.swing.event.ChangeListener
-
mapChanged
public void mapChanged(ScalarMapEvent e)
used for auto-scaling the minimum and maximum- Specified by:
mapChangedin interfaceScalarMapListener- Parameters:
e- the event
-
controlChanged
public void controlChanged(ScalarMapControlEvent evt)
ScalarMapListener method used to detect new control.- Specified by:
controlChangedin interfaceScalarMapListener- Parameters:
evt- the event
-
controlChanged
public void controlChanged(ControlEvent e) throws VisADException, java.rmi.RemoteException
Update slider when value of linked ValueControl changes- Specified by:
controlChangedin interfaceControlListener- Throws:
VisADExceptionjava.rmi.RemoteException
-
-
DMelt 3.0 © DataMelt by jWork.ORG