Package ca.phon.ui
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.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Modifier and TypeFieldDescriptionprotected ChangeEvent
Keep oneChangeEvent
per instanceprotected ChangeListener
The default change listener for the model.protected Format
The formatterprotected int
The number of values between major ticks.protected int
The number of values between minor ticks.protected int
Component orientationprotected boolean
Paint the sliding value label?protected boolean
Snap to ticks?protected boolean
Snap 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_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, 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
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
-
Constructor Summary
ConstructorDescriptionDefault 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 TypeMethodDescriptionvoid
addChangeListener
(ChangeListener listener) Add a change listener.protected void
Fire state change.Get the change listeners.int
Return the length value.int
Return the maximum.int
Return the minimumgetModel()
The data model that handles the components four main attributes: min, max, start, lengthint
The component orientation.int
getStart()
Return the start valuegetUI()
Get the UI object.Get UI classname.boolean
Is one of the knobs being dragged?boolean
static void
void
removeChangeListener
(ChangeListener listener) Remote a change listener.void
setLabelFormat
(Format labelFormat) void
setLength
(int length) Set the lengthvoid
setMaximum
(int max) Set the maximumvoid
setMinimum
(int min) Set the minimum.void
setModel
(BoundedRangeModel model) Set the model.void
setOrientation
(int orientation) Set the component orientaiton.void
setPaintSlidingLabel
(boolean paintSlidingLabel) void
setStart
(int value) Set the start valuevoid
setUI
(RangeSliderUI ui) Set the component UI.void
setValueIsAdjusting
(boolean adjusting) Sets the valueIsAdjusting property.void
updateUI()
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, update
Methods 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, 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, 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 oneChangeEvent
per 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
Get the UI object.- Overrides:
getUI
in classJComponent
-
setUI
Set the component UI. -
updateUI
public void updateUI()Update UI- Overrides:
updateUI
in classJComponent
-
getUIClassID
Get UI classname.- Overrides:
getUIClassID
in classJComponent
-
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)
-