fr.inria.infovis.panel
Class RangeSlider

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byfr.inria.infovis.panel.RangeSlider
All Implemented Interfaces:
javax.swing.event.ChangeListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public class RangeSlider
extends javax.swing.JComponent
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, javax.swing.event.ChangeListener

Author:
raf A replacement of the RangeSlider of Infovis
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
 
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
RangeSlider(javax.swing.BoundedRangeModel model)
          Creates a new RangeSlider object.
RangeSlider(int minimum, int maximum, int lowValue, int highValue)
          Constructs a new range slider.
 
Method Summary
 boolean contains(int v)
          Returns true if the specified value is within the range indicated by this range slider. i.e. lowValue 1 <= v <= highValue.
 int getHighValue()
          Returns the current "high" value shown by the range slider's bar.
 int getLowValue()
          Returns the current "low" value shown by the range slider's bar.
 int getMaximum()
          Returns the maximum possible value for either the low value or the high value.
 int getMinimum()
          Returns the minimum possible value for either the low value or the high value.
 javax.swing.BoundedRangeModel getModel()
          Returns the sizeModel.
 java.awt.Dimension getPreferredSize()
           
 java.lang.String getToolTipText(java.awt.event.MouseEvent event)
           
static void main(java.lang.String[] args)
          Test code.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void setEnabled(boolean v)
           
 void setHighValue(int highValue)
          Sets the high value shown by this range slider.
 void setLowValue(int lowValue)
          Sets the low value shown by this range slider.
 void setMaximum(int max)
          Sets the maximum value of the sizeModel.
 void setMinimum(int min)
          Sets the minimum value of the sizeModel.
 void setModel(javax.swing.BoundedRangeModel model)
          Sets the sizeModel.
 void stateChanged(javax.swing.event.ChangeEvent e)
           
 
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, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, 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, 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, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RangeSlider

public RangeSlider(int minimum,
                   int maximum,
                   int lowValue,
                   int highValue)
Constructs a new range slider.

Parameters:
minimum - - the minimum value of the range.
maximum - - the maximum value of the range.
lowValue - - the current low value shown by the range slider's bar.
highValue - - the current high value shown by the range slider's bar.

RangeSlider

public RangeSlider(javax.swing.BoundedRangeModel model)
Creates a new RangeSlider object.

Parameters:
model - the BoundedRangeModel.
Method Detail

getLowValue

public int getLowValue()
Returns the current "low" value shown by the range slider's bar. The low value meets the constraint minimum <= lowValue <= highValue <= maximum.

Returns:
the current "low" value shown by the range slider's bar.

getHighValue

public int getHighValue()
Returns the current "high" value shown by the range slider's bar. The high value meets the constraint minimum <= lowValue <= highValue <= maximum.

Returns:
the current "high" value shown by the range slider's bar.

getMinimum

public int getMinimum()
Returns the minimum possible value for either the low value or the high value.

Returns:
the minimum possible value for either the low value or the high value.

getMaximum

public int getMaximum()
Returns the maximum possible value for either the low value or the high value.

Returns:
the maximum possible value for either the low value or the high value.

contains

public boolean contains(int v)
Returns true if the specified value is within the range indicated by this range slider. i.e. lowValue 1 <= v <= highValue.

Parameters:
v - value
Returns:
true if the specified value is within the range indicated by this range slider.

setLowValue

public void setLowValue(int lowValue)
Sets the low value shown by this range slider. This causes the range slider to be repainted and a RangeEvent to be fired.

Parameters:
lowValue - the low value shown by this range slider

setHighValue

public void setHighValue(int highValue)
Sets the high value shown by this range slider. This causes the range slider to be repainted and a RangeEvent to be fired.

Parameters:
highValue - the high value shown by this range slider

setMinimum

public void setMinimum(int min)
Sets the minimum value of the sizeModel.

Parameters:
min - the minimum value.

setMaximum

public void setMaximum(int max)
Sets the maximum value of the sizeModel.

Parameters:
max - the maximum value.

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener
See Also:
MouseListener.mousePressed(java.awt.event.MouseEvent)

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
See Also:
MouseMotionListener.mouseDragged(java.awt.event.MouseEvent)

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener
See Also:
MouseListener.mouseReleased(java.awt.event.MouseEvent)

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
See Also:
MouseMotionListener.mouseMoved(java.awt.event.MouseEvent)

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener
See Also:
MouseListener.mouseClicked(java.awt.event.MouseEvent)

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener
See Also:
MouseListener.mouseEntered(java.awt.event.MouseEvent)

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener
See Also:
MouseListener.mouseExited(java.awt.event.MouseEvent)

getPreferredSize

public java.awt.Dimension getPreferredSize()
See Also:
JComponent.getPreferredSize()

setEnabled

public void setEnabled(boolean v)
See Also:
JComponent.setEnabled(boolean)

stateChanged

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

getModel

public javax.swing.BoundedRangeModel getModel()
Returns the sizeModel.

Returns:
BoundedRangeModel

setModel

public void setModel(javax.swing.BoundedRangeModel model)
Sets the sizeModel.

Parameters:
model - The BoundedRangeModel to set

getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent event)
See Also:
JComponent.getToolTipText(MouseEvent)

main

public static void main(java.lang.String[] args)
Test code.

Parameters:
args - Command line arguments.