|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
edu.harvard.seas.iis.util.ui.JRangeSlider
public class JRangeSlider
Implements a Swing-based Range slider, which allows the user to enter a range (minimum and maximum) value.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.BaselineResizeBehavior |
Field Summary | |
---|---|
static int |
HORIZONTAL
|
static int |
LEFTRIGHT_TOPBOTTOM
|
static int |
PREFERRED_BREADTH
|
static int |
PREFERRED_LENGTH
|
static int |
RIGHTLEFT_BOTTOMTOP
|
static int |
VERTICAL
|
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 | |
---|---|
JRangeSlider(javax.swing.BoundedRangeModel model,
int orientation,
int direction)
Create a new range slider. |
|
JRangeSlider(int minimum,
int maximum,
int lowValue,
int highValue,
int orientation)
Create a new range slider. |
|
JRangeSlider(int minimum,
int maximum,
int lowValue,
int highValue,
int orientation,
int direction)
Create a new range slider. |
Method Summary | |
---|---|
void |
addChangeListener(javax.swing.event.ChangeListener cl)
Registers a listener for ChangeEvents. |
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()
Gets the maximum possible value for either the low value or the high value. |
int |
getMinimum()
Gets the minimum possible value for either the low value or the high value. |
javax.swing.BoundedRangeModel |
getModel()
Get the BoundedRangeModel backing this slider. |
java.awt.Dimension |
getPreferredSize()
|
java.awt.Color |
getThumbColor()
Get the slider thumb color. |
void |
keyPressed(java.awt.event.KeyEvent e)
|
void |
keyReleased(java.awt.event.KeyEvent e)
|
void |
keyTyped(java.awt.event.KeyEvent e)
|
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 |
paintComponent(java.awt.Graphics g)
|
void |
removeChangeListener(javax.swing.event.ChangeListener cl)
Removes a listener for ChangeEvents. |
void |
setEmpty(boolean empty)
Sets whether this slider is empty. |
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 maximum)
Sets the maximum possible value for either the low value or the high value. |
void |
setMinExtent(int minExtent)
Sets the minimum extent (difference between low and high values). |
void |
setMinimum(int minimum)
Sets the minimum possible value for either the low value or the high value. |
void |
setModel(javax.swing.BoundedRangeModel brm)
Set the BoundedRangeModel backing this slider. |
void |
setRange(int lowValue,
int highValue)
Set the slider range span. |
void |
setThumbColor(java.awt.Color thumbColor)
Set the slider thumb color. |
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, getBaseline, getBaselineResizeBehavior, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, setEnabled, 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 |
Field Detail |
---|
public static final int VERTICAL
public static final int HORIZONTAL
public static final int LEFTRIGHT_TOPBOTTOM
public static final int RIGHTLEFT_BOTTOMTOP
public static final int PREFERRED_BREADTH
public static final int PREFERRED_LENGTH
Constructor Detail |
---|
public JRangeSlider(int minimum, int maximum, int lowValue, int highValue, int orientation)
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.orientation
- - construct a horizontal or vertical slider?public JRangeSlider(int minimum, int maximum, int lowValue, int highValue, int orientation, int direction)
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.orientation
- - construct a horizontal or vertical slider?direction
- - Is the slider left-to-right/top-to-bottom or right-to-left/bottom-to-toppublic JRangeSlider(javax.swing.BoundedRangeModel model, int orientation, int direction)
model
- - a BoundedRangeModel specifying the slider's rangeorientation
- - construct a horizontal or vertical slider?direction
- - Is the slider left-to-right/top-to-bottom or right-to-left/bottom-to-topMethod Detail |
---|
public int getLowValue()
public void setLowValue(int lowValue)
lowValue
- the low value to usepublic int getHighValue()
public void setHighValue(int highValue)
highValue
- the high value to usepublic void setRange(int lowValue, int highValue)
lowValue
- the low value of the slider rangehighValue
- the high value of the slider rangepublic int getMinimum()
public void setMinimum(int minimum)
minimum
- the minimum possible range valuepublic int getMaximum()
public void setMaximum(int maximum)
maximum
- the maximum possible range valuepublic void setMinExtent(int minExtent)
minExtent
- the minimum extent allowed in subsequent interactionpublic void setEmpty(boolean empty)
empty
- true if set to empty, false otherwisepublic java.awt.Color getThumbColor()
public void setThumbColor(java.awt.Color thumbColor)
thumbColor
- the slider thumb colorpublic javax.swing.BoundedRangeModel getModel()
public void setModel(javax.swing.BoundedRangeModel brm)
brm
- the slider range model to usepublic void addChangeListener(javax.swing.event.ChangeListener cl)
cl
- the ChangeListener to addpublic void removeChangeListener(javax.swing.event.ChangeListener cl)
cl
- the ChangeListener to removepublic java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
Component.getPreferredSize()
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
JComponent.paintComponent(java.awt.Graphics)
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
MouseListener.mousePressed(java.awt.event.MouseEvent)
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
MouseMotionListener.mouseDragged(java.awt.event.MouseEvent)
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
MouseListener.mouseReleased(java.awt.event.MouseEvent)
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
MouseMotionListener.mouseMoved(java.awt.event.MouseEvent)
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
MouseListener.mouseClicked(java.awt.event.MouseEvent)
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
MouseListener.mouseEntered(java.awt.event.MouseEvent)
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
MouseListener.mouseExited(java.awt.event.MouseEvent)
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
KeyListener.keyPressed(java.awt.event.KeyEvent)
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
KeyListener.keyReleased(java.awt.event.KeyEvent)
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
KeyListener.keyTyped(java.awt.event.KeyEvent)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |