|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent prefuse.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 | |
---|---|
protected class |
JRangeSlider.RangeSliderChangeListener
Listener that fires a change event when it receives change event from the slider list model. |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected static int |
ARROW_HEIGHT
|
protected static int |
ARROW_SZ
|
protected static int |
ARROW_WIDTH
|
protected javax.swing.event.ChangeEvent |
changeEvent
|
protected int |
direction
|
protected boolean |
empty
|
static int |
HORIZONTAL
|
protected int |
increment
|
static int |
LEFTRIGHT_TOPBOTTOM
|
protected java.util.ArrayList |
listeners
|
protected javax.swing.event.ChangeListener |
lstnr
|
protected int |
minExtent
|
protected javax.swing.BoundedRangeModel |
model
|
protected int |
orientation
|
static int |
PREFERRED_BREADTH
|
static int |
PREFERRED_LENGTH
|
static int |
RIGHTLEFT_BOTTOMTOP
|
protected java.awt.Color |
thumbColor
|
static int |
VERTICAL
|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, 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 |
---|
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. |
protected javax.swing.event.ChangeListener |
createListener()
Create a listener to relay change events from the bounded range model. |
protected void |
customPaint(java.awt.Graphics2D g,
int width,
int height)
Override this method to perform custom painting of the slider trough. |
protected void |
fireChangeEvent()
Fire a change event to all listeners. |
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)
|
protected void |
paint3DRectLighting(java.awt.Graphics2D g2,
int x,
int y,
int width,
int height)
Adds Windows2K type 3D lighting effects |
protected void |
paintArrow(java.awt.Graphics2D g2,
double x,
double y,
int w,
int h,
boolean topDown)
This draws an arrow as a series of lines within the specified box. |
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. |
protected int |
toLocal(int xOrY)
Converts from screen coordinates to a range value. |
protected int |
toScreen(int xOrY)
Converts from a range value to screen coordinates. |
protected double |
toScreenDouble(int xOrY)
Converts from a range value to screen coordinates. |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, 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, paintBorder, paintChildren, 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, updateUI |
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, transferFocusBackward, 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, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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 |
---|
clone, equals, finalize, 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
protected static final int ARROW_SZ
protected static final int ARROW_WIDTH
protected static final int ARROW_HEIGHT
protected javax.swing.BoundedRangeModel model
protected int orientation
protected int direction
protected boolean empty
protected int increment
protected int minExtent
protected java.util.ArrayList listeners
protected javax.swing.event.ChangeEvent changeEvent
protected javax.swing.event.ChangeListener lstnr
protected java.awt.Color thumbColor
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 |
---|
protected javax.swing.event.ChangeListener createListener()
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 removeprotected void fireChangeEvent()
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
Component.getPreferredSize()
protected void customPaint(java.awt.Graphics2D g, int width, int height)
g
- a Graphics2D context for renderingwidth
- the width of the slider troughheight
- the height of the slider troughpublic void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
JComponent.paintComponent(java.awt.Graphics)
protected void paintArrow(java.awt.Graphics2D g2, double x, double y, int w, int h, boolean topDown)
protected void paint3DRectLighting(java.awt.Graphics2D g2, int x, int y, int width, int height)
protected int toLocal(int xOrY)
protected int toScreen(int xOrY)
protected double toScreenDouble(int xOrY)
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 |