Class JRangeSlider
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
ca.phon.ui.JRangeSlider
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,SwingConstants
A component that lets the user graphically select a contiguous range of values by
sliding knobs withing a bounded interval. Like the regular swing JSlider,
the component can show both major ticks marks and minor tick marks between
them.
- Version:
- 1.0 2007-04-22
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ChangeEventKeep oneChangeEventper instanceprotected ChangeListenerThe default change listener for the model.protected FormatThe formatterprotected intThe number of values between major ticks.protected intThe number of values between minor ticks.protected intComponent orientationprotected booleanPaint the sliding value label?protected booleanSnap to ticks?protected booleanSnap to value?Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields 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 -
Constructor Summary
ConstructorsConstructorDescriptionDefault Constructor.JRangeSlider(int orientation) Creates a slider with the specified orientation with range [0-100] and selected range [20-80].JRangeSlider(int min, int max, int start, int length) Creates a horizontal slider with the specified range and selected range.JRangeSlider(int orientation, int min, int max, int start, int length) Creates a slider with the spectified orientation, range, and selected range. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChangeListener(ChangeListener listener) Add a change listener.protected voidFire state change.Get the change listeners.intReturn the length value.intReturn the maximum.intReturn the minimumgetModel()The data model that handles the components four main attributes: min, max, start, lengthintThe component orientation.intgetStart()Return the start valuegetUI()Get the UI object.Get UI classname.booleanIs one of the knobs being dragged?booleanstatic voidvoidremoveChangeListener(ChangeListener listener) Remote a change listener.voidsetLabelFormat(Format labelFormat) voidsetLength(int length) Set the lengthvoidsetMaximum(int max) Set the maximumvoidsetMinimum(int min) Set the minimum.voidsetModel(BoundedRangeModel model) Set the model.voidsetOrientation(int orientation) Set the component orientaiton.voidsetPaintSlidingLabel(boolean paintSlidingLabel) voidsetStart(int value) Set the start valuevoidsetUI(RangeSliderUI ui) Set the component UI.voidsetValueIsAdjusting(boolean adjusting) Sets the valueIsAdjusting property.voidupdateUI()Update UIMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, 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, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
majorTickSpacing
protected int majorTickSpacingThe number of values between major ticks. -
minorTickSpacing
protected int minorTickSpacingThe number of values between minor ticks. -
snapToTicks
protected boolean snapToTicksSnap to ticks? -
snapToValue
protected boolean snapToValueSnap to value? -
paintSlidingLabel
protected boolean paintSlidingLabelPaint the sliding value label? -
orientation
protected int orientationComponent orientation -
changeListener
The default change listener for the model. -
labelFormat
The formatter -
changeEvent
Keep oneChangeEventper instance
-
-
Constructor Details
-
JRangeSlider
public JRangeSlider()Default Constructor. Creates a horizontal slider with range[0-100] and selected range [20-80]. -
JRangeSlider
public JRangeSlider(int orientation) Creates a slider with the specified orientation with range [0-100] and selected range [20-80]. -
JRangeSlider
public JRangeSlider(int min, int max, int start, int length) Creates a horizontal slider with the specified range and selected range.- Parameters:
min-max-start-length-
-
JRangeSlider
public JRangeSlider(int orientation, int min, int max, int start, int length) Creates a slider with the spectified orientation, range, and selected range.- Parameters:
orientation-min-max-start-length-
-
-
Method Details
-
getUI
-
setUI
Set the component UI. -
updateUI
-
getUIClassID
-
addChangeListener
Add a change listener. -
removeChangeListener
Remote a change listener. -
getChangeListeners
Get the change listeners. -
fireStateChange
protected void fireStateChange()Fire state change. -
getModel
The data model that handles the components four main attributes: min, max, start, length -
setModel
Set the model. -
getStart
public int getStart()Return the start value -
setStart
public void setStart(int value) Set the start value- Parameters:
value-
-
getLength
public int getLength()Return the length value. -
setLength
public void setLength(int length) Set the length- Parameters:
length-
-
getMinimum
public int getMinimum()Return the minimum -
setMinimum
public void setMinimum(int min) Set the minimum.- Parameters:
min-
-
getMaximum
public int getMaximum()Return the maximum. -
setMaximum
public void setMaximum(int max) Set the maximum -
getValueIsAdjusting
public boolean getValueIsAdjusting()Is one of the knobs being dragged? -
setValueIsAdjusting
public void setValueIsAdjusting(boolean adjusting) Sets the valueIsAdjusting property. -
getOrientation
public int getOrientation()The component orientation. -
setOrientation
public void setOrientation(int orientation) Set the component orientaiton. -
main
-
getLabelFormat
-
setLabelFormat
-
isPaintSlidingLabel
public boolean isPaintSlidingLabel() -
setPaintSlidingLabel
public void setPaintSlidingLabel(boolean paintSlidingLabel)
-