public class VRangeSlider extends JComponent implements MouseListener, MouseMotionListener
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected boolean |
drawLabels
Flag determining whether text labels are drawn.
|
protected EventListenerList |
listenerList
list of listeners for change events
|
protected double |
maxLimit
Maximum slider value.
|
protected Dimension |
maxSize
Maximum widget size.
|
protected double |
maxValue
Percent through scale of max gripper.
|
protected double |
minLimit
Minimum slider value.
|
protected Dimension |
minSize
Minimum widget size.
|
protected double |
minValue
Percent through scale of min gripper.
|
protected Dimension |
prefSize
Preferred widget size.
|
TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
VRangeSlider(String label,
double min,
double max)
Constructs a VRangeSlider with the specified range of values.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ChangeListener l)
register to receive change events from this object whenever the
min or max values are changed.
|
protected void |
fireChange()
Notify any listeners of a change in the image or cut levels.
|
boolean |
getDrawLabels()
Indicates whether textual annotations will be drawn near this
widget.
|
Dimension |
getMaximumSize()
Returns maximum size of range slider.
|
double |
getMaxValue()
Percent through scale of max gripper.
|
Dimension |
getMinimumSize()
Returns minimum size of range slider.
|
double[] |
getMinMaxValues()
Gets minimum and maximum slider values.
|
double |
getMinValue()
Percent through scale of min gripper.
|
Dimension |
getPreferredSize()
Returns preferred size of range slider.
|
static void |
main(String[] argv)
Main method for testing purposes.
|
void |
mouseClicked(MouseEvent e)
Not used.
|
void |
mouseDragged(MouseEvent e)
MouseMotionListener method for moving slider.
|
void |
mouseEntered(MouseEvent e)
Not used.
|
void |
mouseExited(MouseEvent e)
Not used.
|
void |
mouseMoved(MouseEvent e)
Not used.
|
void |
mousePressed(MouseEvent e)
MouseListener method for moving slider.
|
void |
mouseReleased(MouseEvent e)
MouseListener method for moving slider.
|
void |
paintComponent(Graphics g)
Draws the slider from scratch.
|
void |
removeChangeListener(ChangeListener l)
Stop receiving change events from this object.
|
protected void |
resetValues(double min,
double max)
Resets the minimum and maximum values.
|
void |
setBounds(double min,
double max)
Sets the slider's lo and hi bounds.
|
void |
setBounds(int x,
int y,
int w,
int h)
Redraws the slider if the widget width changes.
|
void |
setDrawLabels(boolean drawLabels)
Determines whether textual annotations should be drawn near this
widget.
|
void |
setMaximumSize(Dimension dim)
Sets preferred size of range slider.
|
void |
setMinimumSize(Dimension dim)
Sets minimum size of range slider.
|
void |
setName(String name)
Sets the slider's name.
|
void |
setPreferredSize(Dimension dim)
Sets preferred size of range slider.
|
void |
setValues(double lo,
double hi)
Sets the slider's lo and hi values.
|
void |
valuesUpdated()
Called whenever the min or max value is updated.
|
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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
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
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, getPeer, 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, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected double minValue
protected double maxValue
protected double minLimit
protected double maxLimit
protected Dimension minSize
protected Dimension prefSize
protected Dimension maxSize
protected boolean drawLabels
protected EventListenerList listenerList
public VRangeSlider(String label, double min, double max)
public double getMinValue()
public double getMaxValue()
public double[] getMinMaxValues()
protected void resetValues(double min, double max)
public void setName(String name)
public void setBounds(double min, double max)
public void setValues(double lo, double hi)
public void setBounds(int x, int y, int w, int h)
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void addChangeListener(ChangeListener l)
public void removeChangeListener(ChangeListener l)
protected void fireChange()
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public Dimension getMinimumSize()
getMinimumSize
in class JComponent
public void setMinimumSize(Dimension dim)
setMinimumSize
in class JComponent
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
public void setPreferredSize(Dimension dim)
setPreferredSize
in class JComponent
public Dimension getMaximumSize()
getMaximumSize
in class JComponent
public void setMaximumSize(Dimension dim)
setMaximumSize
in class JComponent
public void valuesUpdated()
public void paintComponent(Graphics g)
paintComponent
in class JComponent
public void setDrawLabels(boolean drawLabels)
drawLabels
- whether to draw textual annotationpublic boolean getDrawLabels()
public static void main(String[] argv)
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.