com.tensegrity.gui.swing.control
Class SliderTextPanel

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

public class SliderTextPanel
extends javax.swing.JPanel
implements javax.swing.event.ChangeListener

This class represents a slider coupled with a textfield. The two components interact. The slider will adjust itself to the value of the textfield and vice versa. It is possible to type a number into the textfield and the slider is adjusted if return is pressed.

Version:
$Id: SliderTextPanel.java,v 1.7 2005/09/06 10:49:50 BurkhardWick Exp $
Author:
Stepan Rutz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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.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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SliderTextPanel(java.lang.String text, int min, int max, int value)
          Creates a silder panel with a slider and a textfield that are coupled.
SliderTextPanel(UIManager uiManager, java.lang.String text, int min, int max, int value)
          Creates a silder panel with a slider and a textfield that are coupled.
 
Method Summary
 int getMaximum()
          Returns the maximum value
 int getMinimum()
          Returns the minimum value
 int getValue()
          Retrieves the value of the slider.
 void setMajorTickSpacing(int spacing)
          Sets the major tick spacing for the internal slider.
 void setMaximum(int max)
          Sets the maximum value
 void setMinimum(int min)
          Sets the minimum value
 void setMinorTickSpacing(int spacing)
          Sets the minor tick spacing for the internal slider.
 void setSnapToTickDistance(int dist)
          Sets the distance in values for the snap to tick functionality.
 void setValue(int n)
          Sets the value of the slider.
 void stateChanged(javax.swing.event.ChangeEvent e)
          Sets the new Label in the label table of this slider.
 
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

SliderTextPanel

public SliderTextPanel(java.lang.String text,
                       int min,
                       int max,
                       int value)
Creates a silder panel with a slider and a textfield that are coupled.

Parameters:
text - the text to display for the slider.
min - the minimum value for the slider.
max - the maximum value for the slider.
value - the initial value for the slider

SliderTextPanel

public SliderTextPanel(UIManager uiManager,
                       java.lang.String text,
                       int min,
                       int max,
                       int value)
Creates a silder panel with a slider and a textfield that are coupled.

Parameters:
uiManager - the uimanager used to create messages
text - the text to display for the slider.
min - the minimum value for the slider.
max - the maximum value for the slider.
value - the initial value for the slider
Method Detail

setMajorTickSpacing

public void setMajorTickSpacing(int spacing)
Sets the major tick spacing for the internal slider.

Parameters:
spacing - the new spacing.
See Also:
JSlider.setMajorTickSpacing(int)

setMinorTickSpacing

public void setMinorTickSpacing(int spacing)
Sets the minor tick spacing for the internal slider.

Parameters:
spacing - the new spacing.
See Also:
JSlider.setMinorTickSpacing(int)

getValue

public int getValue()
Retrieves the value of the slider. The value is in the interval that is specified upon creation of the instance.

Returns:
the value of the slider.

setValue

public void setValue(int n)
Sets the value of the slider. The value must be in the interval that is specified upon creation of the instance.

Parameters:
n - the slider value.

setMaximum

public void setMaximum(int max)
Sets the maximum value

Parameters:
max - the maximum value

setMinimum

public void setMinimum(int min)
Sets the minimum value

Parameters:
min - the minimum value

getMaximum

public int getMaximum()
Returns the maximum value

Returns:
the maximum value

getMinimum

public int getMinimum()
Returns the minimum value

Returns:
the minimum value

setSnapToTickDistance

public void setSnapToTickDistance(int dist)
Sets the distance in values for the snap to tick functionality.

Parameters:
dist - The distance or 0 to disable snapping

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)


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