com.tensegrity.gui.swing.control
Class ValueSlider

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JSlider
                  extended bycom.tensegrity.gui.swing.control.ValueSlider
All Implemented Interfaces:
javax.accessibility.Accessible, javax.swing.event.ChangeListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.SwingConstants

public class ValueSlider
extends javax.swing.JSlider
implements javax.swing.event.ChangeListener

A ValueSlider slider is a JSlider which displays the current value as label below the slidertrack.

Version:
$Id: ValueSlider.java,v 1.11 2005/09/13 13:49:01 BurkhardWick Exp $
Author:
Gilles Iachelini
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JSlider
javax.swing.JSlider.AccessibleJSlider
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JSlider
changeEvent, changeListener, majorTickSpacing, minorTickSpacing, orientation, sliderModel, snapToTicks
 
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.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ValueSlider()
          Constructor for ValueSlider.
ValueSlider(javax.swing.BoundedRangeModel brm)
          Constructor for ValueSlider.
ValueSlider(int min, int max)
          Constructor for ValueSlider.
ValueSlider(int min, int max, int value)
          Constructor for ValueSlider.
ValueSlider(int orientation, int min, int max, int value)
          Constructor for ValueSlider.
 
Method Summary
 void enableSnap(boolean enable)
          Enables or disables the snapping
 java.lang.String getLabelPrefix()
          Returns the labelPrefix.
 java.lang.String getLabelSuffix()
          Returns the labelSuffix.
 void setLabelPrefix(java.lang.String labelPrefix)
          Sets the labelPrefix.
 void setLabelSuffix(java.lang.String labelSuffix)
          Sets the labelSuffix.
 void setLabelTable(java.util.Dictionary labels)
          Overwritten to merge current value key-value pair with the given table of labels.
 void setPaintLabels(boolean b)
          This method is overwritten to ensure that this slider will work.
 void setSnap(int snapValue, int snapRegion)
          Sets the value and the region for snapping
 void stateChanged(javax.swing.event.ChangeEvent e)
          Sets the new Label in the label table of this slider.
 
Methods inherited from class javax.swing.JSlider
addChangeListener, createChangeListener, createStandardLabels, createStandardLabels, fireStateChanged, getAccessibleContext, getChangeListeners, getExtent, getInverted, getLabelTable, getMajorTickSpacing, getMaximum, getMinimum, getMinorTickSpacing, getModel, getOrientation, getPaintLabels, getPaintTicks, getPaintTrack, getSnapToTicks, getUI, getUIClassID, getValue, getValueIsAdjusting, paramString, removeChangeListener, setExtent, setInverted, setMajorTickSpacing, setMaximum, setMinimum, setMinorTickSpacing, setModel, setOrientation, setPaintTicks, setPaintTrack, setSnapToTicks, setUI, setValue, setValueIsAdjusting, updateLabelUIs, 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

ValueSlider

public ValueSlider()
Constructor for ValueSlider.


ValueSlider

public ValueSlider(int min,
                   int max)
Constructor for ValueSlider.

Parameters:
min - minimum value.
max - maximum value.

ValueSlider

public ValueSlider(int min,
                   int max,
                   int value)
Constructor for ValueSlider.

Parameters:
min - minimum value.
max - maximum value.
value - current value for the slider when created.

ValueSlider

public ValueSlider(int orientation,
                   int min,
                   int max,
                   int value)
Constructor for ValueSlider.

Parameters:
orientation - either horizontal or vertical.
min - minimum value.
max - maximum value.
value - current value for the slider when created.

ValueSlider

public ValueSlider(javax.swing.BoundedRangeModel brm)
Constructor for ValueSlider.

Parameters:
brm - the BoundedRangeModel for this slider.
Method Detail

setPaintLabels

public void setPaintLabels(boolean b)
This method is overwritten to ensure that this slider will work. It doesnt allow to set this flag to false. If this flag is set to false, no labels will be drawn and the current value cannot be displayed.

See Also:
JSlider.setPaintLabels(boolean)

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Sets the new Label in the label table of this slider.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
See Also:
ChangeListener.stateChanged(ChangeEvent)

setLabelTable

public void setLabelTable(java.util.Dictionary labels)
Overwritten to merge current value key-value pair with the given table of labels.

See Also:
JSlider.setLabelTable(Dictionary)

getLabelPrefix

public java.lang.String getLabelPrefix()
Returns the labelPrefix.

Returns:
String

getLabelSuffix

public java.lang.String getLabelSuffix()
Returns the labelSuffix.

Returns:
String

setLabelPrefix

public void setLabelPrefix(java.lang.String labelPrefix)
Sets the labelPrefix.

Parameters:
labelPrefix - The labelPrefix to set

setLabelSuffix

public void setLabelSuffix(java.lang.String labelSuffix)
Sets the labelSuffix.

Parameters:
labelSuffix - The labelSuffix to set

enableSnap

public void enableSnap(boolean enable)
Enables or disables the snapping

Parameters:
enable - true, to enable the snapping

setSnap

public void setSnap(int snapValue,
                    int snapRegion)
Sets the value and the region for snapping

Parameters:
snapValue - The value to snap to
snapRegion - The region for the snapValue, so the snapValue will be used if: value - snapRegion <= value <= value + snapRegion


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.