Package com.inductiveautomation.rm.swing
Class RJThumbWheel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
com.inductiveautomation.rm.swing.RJThumbWheel
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable
This class has the behavior of a slider, without boundaries (so you can set values beyond the visible min and max).
Furthermore, it has a 3D thumbwheel look, that is particularly nice for radial values. It also has an optional linear
look, which is good for unbounded linear values.
- 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 TypeFieldDescriptionstatic final bytestatic final bytestatic final bytestatic final byteFields 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, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a change listener.floatReturns the largest value permitted by the thumbwheel (even when outside visible range).floatReturns the smallest value permitted by the thumbwheel (even when outside visible range).byteReturns the thumbhweel absolute mode (ABSOLUTE_BOUNDED or ABSOLUTE_WRAPPED).intReturns the orientation (SwingConstants.VERTICAL or SwingConstants.HORIZONTAL).floatgetRound()Returns the value that thumbwheel values are rounded to.bytegetType()Returns the type (radial or linear).doublegetValue()Returns the value.doublegetValueAtPoint(Point aPoint) This method gives the value that corresponds to a point with respect to the given frame and the visible range.booleanReturns whether the thumbweel is in a state of rapid interactive use (from mouse loop).floatReturns the largest value in the visible range (ie, on the right side) of the thumbhweel.floatReturns the smallest value in the visible range (ie, on the left side) of the thumbhweel.floatReturns the extent of the thumbwheel's visible range.booleanReturns whether thumbwheel is absolute bounded.booleanReturns whether thumbwheel is horizontal.booleanisLinear()Returns whether thumbwheel is linear.booleanisRadial()Returns whether thumbwheel is radial.booleanReturns whether thumbwheel is vertical.booleanReturns whether thumbwheel does absolute wrapping.protected voidmouseDragged(MouseEvent anEvent) Mouse Pressed.protected voidmousePressed(MouseEvent anEvent) Mouse Pressed.voidmouseReleased(MouseEvent anEvent) Mouse Released.voidPaints the component.protected voidForwards mouse events to mouse methods.protected voidForwards mouse events to mouse methods.voidRemove a change listener.voidsetAbsoluteMax(float aValue) Sets the largest value permitted by the thumbwheel (even when outside visible range).voidsetAbsoluteMin(float aValue) Sets the smallest value permitted by the thumbwheel (even when outside visible range).voidsetAbsoluteMode(byte aValue) Sets the thumbhweel absolute mode (ABSOLUTE_BOUNDED or ABSOLUTE_WRAPPED).voidsetBackground(Color aColor) Overrides to reset image.voidsetBounds(int x, int y, int width, int height) Override to reset image and set orientation.voidsetForeground(Color aColor) Overrides to reset image.voidsetOrientation(int aValue) Returns the orientation (SwingConstants.VERTICAL or SwingConstants.HORIZONTAL).voidsetRound(float aValue) Sets the value that thumbwheel values are rounded to.voidsetType(byte aType) Sets the type (radial or linear).voidsetValue(double aValue) Sets the value.voidsetVisibleMax(float aValue) Sets the largest value in the visible range (ie, on the right side) of the thumbhweel.voidsetVisibleMin(float aValue) Sets the smallest value in the visible range (ie, on the left side) of the thumbhweel.Methods 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, getUI, 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, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUIMethods 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
TYPE_RADIAL
public static final byte TYPE_RADIAL- See Also:
-
TYPE_LINEAR
public static final byte TYPE_LINEAR- See Also:
-
ABSOLUTE_BOUNDED
public static final byte ABSOLUTE_BOUNDED- See Also:
-
ABSOLUTE_WRAPPED
public static final byte ABSOLUTE_WRAPPED- See Also:
-
-
Constructor Details
-
RJThumbWheel
public RJThumbWheel()Creates a new thumbwheel.
-
-
Method Details
-
getType
public byte getType()Returns the type (radial or linear). -
setType
public void setType(byte aType) Sets the type (radial or linear). -
getValue
public double getValue()Returns the value. -
setValue
public void setValue(double aValue) Sets the value. -
getRound
public float getRound()Returns the value that thumbwheel values are rounded to. -
setRound
public void setRound(float aValue) Sets the value that thumbwheel values are rounded to. -
getVisibleMin
public float getVisibleMin()Returns the smallest value in the visible range (ie, on the left side) of the thumbhweel. -
setVisibleMin
public void setVisibleMin(float aValue) Sets the smallest value in the visible range (ie, on the left side) of the thumbhweel. -
getVisibleMax
public float getVisibleMax()Returns the largest value in the visible range (ie, on the right side) of the thumbhweel. -
setVisibleMax
public void setVisibleMax(float aValue) Sets the largest value in the visible range (ie, on the right side) of the thumbhweel. -
getAbsoluteMin
public float getAbsoluteMin()Returns the smallest value permitted by the thumbwheel (even when outside visible range). -
setAbsoluteMin
public void setAbsoluteMin(float aValue) Sets the smallest value permitted by the thumbwheel (even when outside visible range). -
getAbsoluteMax
public float getAbsoluteMax()Returns the largest value permitted by the thumbwheel (even when outside visible range). -
setAbsoluteMax
public void setAbsoluteMax(float aValue) Sets the largest value permitted by the thumbwheel (even when outside visible range). -
getAbsoluteMode
public byte getAbsoluteMode()Returns the thumbhweel absolute mode (ABSOLUTE_BOUNDED or ABSOLUTE_WRAPPED). -
setAbsoluteMode
public void setAbsoluteMode(byte aValue) Sets the thumbhweel absolute mode (ABSOLUTE_BOUNDED or ABSOLUTE_WRAPPED). -
getOrientation
public int getOrientation()Returns the orientation (SwingConstants.VERTICAL or SwingConstants.HORIZONTAL). -
setOrientation
public void setOrientation(int aValue) Returns the orientation (SwingConstants.VERTICAL or SwingConstants.HORIZONTAL). -
getValueIsAdjusting
public boolean getValueIsAdjusting()Returns whether the thumbweel is in a state of rapid interactive use (from mouse loop). -
processMouseEvent
Forwards mouse events to mouse methods.- Overrides:
processMouseEventin classJComponent
-
processMouseMotionEvent
Forwards mouse events to mouse methods.- Overrides:
processMouseMotionEventin classJComponent
-
mousePressed
Mouse Pressed. -
mouseDragged
Mouse Pressed. -
mouseReleased
Mouse Released. -
getValueAtPoint
This method gives the value that corresponds to a point with respect to the given frame and the visible range. When in radial mode, the point on the thumbwheel is approximated with a power series for arcCos to get legal values for points outside of the frame. -
isVertical
public boolean isVertical()Returns whether thumbwheel is vertical. -
isHorizontal
public boolean isHorizontal()Returns whether thumbwheel is horizontal. -
isRadial
public boolean isRadial()Returns whether thumbwheel is radial. -
isLinear
public boolean isLinear()Returns whether thumbwheel is linear. -
isBounded
public boolean isBounded()Returns whether thumbwheel is absolute bounded. -
isWrapped
public boolean isWrapped()Returns whether thumbwheel does absolute wrapping. -
getVisibleRange
public float getVisibleRange()Returns the extent of the thumbwheel's visible range. -
paintComponent
Paints the component.- Overrides:
paintComponentin classJComponent
-
addChangeListener
Adds a change listener. -
removeChangeListener
Remove a change listener. -
setBounds
public void setBounds(int x, int y, int width, int height) Override to reset image and set orientation. -
setForeground
Overrides to reset image.- Overrides:
setForegroundin classJComponent
-
setBackground
Overrides to reset image.- Overrides:
setBackgroundin classJComponent
-