infovis.panel.dqinter
Class DoubleRangeSlider

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by infovis.panel.dqinter.DoubleRangeSlider
All Implemented Interfaces:
MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, ChangeListener

public class DoubleRangeSlider
extends JComponent
implements MouseListener, MouseMotionListener, ChangeListener

Implements a Swing-based Range slider, which allows the user to enter a range-based value.

Version:
$Revision: 1.8 $
Author:
Ben B. Bederson, Jon Meyer and Jean-Daniel Fekete
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
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
DoubleRangeSlider(DoubleBoundedRangeModel model)
          Creates a new RangeSlider object.
DoubleRangeSlider(double minimum, double maximum, double lowValue, double highValue)
          Constructs a new range slider.
 
Method Summary
 boolean contains(double v)
          Returns true if the specified value is within the range indicated by this range slider, i˙e˙ lowValue 1 <= v <= highValue.
 double getHighValue()
          Returns the current "high" value shown by the range slider's bar.
 double getLowValue()
          Returns the current "low" value shown by the range slider's bar.
 double getMaximum()
          Returns the maximum possible value for either the low value or the high value.
 double getMinimum()
          Returns the minimum possible value for either the low value or the high value.
 DoubleBoundedRangeModel getModel()
          Returns the doubleBoundedRangeModel.
 Dimension getPreferredSize()
           
 String getToolTipText(MouseEvent event)
           
 void mouseClicked(MouseEvent e)
          
 void mouseDragged(MouseEvent e)
          
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
          
 void mousePressed(MouseEvent e)
          
 void mouseReleased(MouseEvent e)
          
 void setEnabled(boolean v)
           
 void setHighValue(double highValue)
          Sets the high value shown by this range slider.
 void setLowValue(double lowValue)
          Sets the low value shown by this range slider.
 void setMaximum(double max)
          Sets the maximum value of the doubleBoundedRangeModel.
 void setMinimum(double min)
          Sets the minimum value of the doubleBoundedRangeModel.
 void setModel(DoubleBoundedRangeModel model)
          Sets the doubleBoundedRangeModel.
 void stateChanged(ChangeEvent e)
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, 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, 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, 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, hide, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DoubleRangeSlider

public DoubleRangeSlider(double minimum,
                         double maximum,
                         double lowValue,
                         double 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.

DoubleRangeSlider

public DoubleRangeSlider(DoubleBoundedRangeModel model)
Creates a new RangeSlider object.

Parameters:
model - the DoubleBoundedRangeModel
Method Detail

getLowValue

public double 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 double 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 double 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 double 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(double 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(double 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(double 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(double min)
Sets the minimum value of the doubleBoundedRangeModel.

Parameters:
min - the minimum value.

setMaximum

public void setMaximum(double max)
Sets the maximum value of the doubleBoundedRangeModel.

Parameters:
max - the maximum value.

mousePressed

public void mousePressed(MouseEvent e)

Specified by:
mousePressed in interface MouseListener

mouseDragged

public void mouseDragged(MouseEvent e)

Specified by:
mouseDragged in interface MouseMotionListener

mouseReleased

public void mouseReleased(MouseEvent e)

Specified by:
mouseReleased in interface MouseListener

mouseMoved

public void mouseMoved(MouseEvent e)

Specified by:
mouseMoved in interface MouseMotionListener

mouseClicked

public void mouseClicked(MouseEvent e)

Specified by:
mouseClicked in interface MouseListener

mouseEntered

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

mouseExited

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

getPreferredSize

public Dimension getPreferredSize()
Overrides:
getPreferredSize in class JComponent
See Also:
JComponent.getPreferredSize()

setEnabled

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

stateChanged

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

getModel

public DoubleBoundedRangeModel getModel()
Returns the doubleBoundedRangeModel.

Returns:
BoundedRangeModel

setModel

public void setModel(DoubleBoundedRangeModel model)
Sets the doubleBoundedRangeModel.

Parameters:
model - The doubleBoundedRangeModel to set

getToolTipText

public String getToolTipText(MouseEvent event)
Overrides:
getToolTipText in class JComponent
See Also:
JComponent.getToolTipText(MouseEvent)


Copyright 2005 by Jean-Daniel Fekete and INRIA, France All rights reserved.