Package xal.extension.widgets.swing
Class Wheelswitch
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
xal.extension.widgets.swing.Wheelswitch
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible
Descendant of
javax.swing.JPanel that contains a row of digits
and optionally a two way up-down button. It can be used for displaying and
modifying a single formatted double value with an optional unit
string (also in digits) displayed next to the value. Value manipulation and
display formatting is handled by the WheelswitchFormatter.- Version:
- $id$
- Author:
- Jernej Kamenik
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected classprotected classprotected classprotected classprotected classNested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested 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 TypeFieldDescriptionprotected static final intstatic final StringDOCUMENT ME!protected Wheelswitch.FocusHandlerprotected static final intprotected Wheelswitch.KeyHandlerprotected Wheelswitch.MouseHandlerprotected Wheelswitch.TiltHandlerstatic final StringDOCUMENT ME!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_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
ConstructorsConstructorDescriptionConstructor for Wheelswitch which sets no format or unit and the value is set to zero.Wheelswitch(double newValue) Constructor forWheelswitchsetting only the value.Wheelswitch(String newFormat, double newValue, String newUnit) Constructor forWheelswitchcreates a new Wheelswitch with the specified value, format and unit. -
Method Summary
Modifier and TypeMethodDescriptionGets the format of the display.doubleGets the maximum alowed value.doubleGets the minimum alowed value.This method has been overriden to implement correct layout and resizing features.This method has been overriden to implement correct layout and resizing features.protected intgetUnit()Gets the unit displayed next to the value.doublegetValue()Gets the value displayed by theWheelswitchand stored by theformatter.protected voidbooleanReturns whether the wheelswitch can be edited by the user.booleanGets the enhancement mode of theWheelswitch.booleanReturns whether the component should indicate value out of bounds condition by visually tilting its border.protected voidsetDigitValue(int i, int newValue) voidsetEditable(boolean newEditable) Sets the editability of the wheelswitch.voidsetEnabled(boolean arg0) Overriden to implement digit and upDownButton enabling/disabling.voidsetEnhanced(boolean enhanced) Sets the enhanced property of the wheelswitch.voidSets the format of the value display.voidsetGraphMax(double newValue) Sets the maximum allowed value.voidsetGraphMin(double newValue) Sets the minimum allowed value.voidsetMaximumDigits(int bound) Sets the maximum number of value digits allowed to be displayed in the wheelswitch.voidsetMaxMin(double max, double min) Sets the maximum and minimum allowed values.protected voidsetSelectedDigit(int i) voidsetTiltingEnabled(boolean b) Sets the tilitng enabled property.voidSets the unit to be displayed next to the value.voidsetValue(double newValue) Sets the value and displays it in the wheelswitch.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, getNextFocusableComponent, getPopupLocation, 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, 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, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods 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, 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
-
INCREASE_SELECTION
protected static final int INCREASE_SELECTION- See Also:
-
DECREASE_SELECTION
protected static final int DECREASE_SELECTION- See Also:
-
VALUE
DOCUMENT ME!- See Also:
-
EDITABLE_STR
DOCUMENT ME!- See Also:
-
focusHandler
-
keyHandler
-
mouseHandler
-
tiltHandler
-
-
Constructor Details
-
Wheelswitch
Constructor forWheelswitchcreates a new Wheelswitch with the specified value, format and unit. No minimum or maximum values are set.- Parameters:
newFormat-newValue-newUnit-
-
Wheelswitch
public Wheelswitch(double newValue) Constructor forWheelswitchsetting only the value. No format or unit are set.- Parameters:
newValue-- See Also:
-
Wheelswitch
public Wheelswitch()Constructor for Wheelswitch which sets no format or unit and the value is set to zero.- See Also:
-
-
Method Details
-
setEditable
public void setEditable(boolean newEditable) Sets the editability of the wheelswitch.- Parameters:
newEditable-
-
isEditable
public boolean isEditable()Returns whether the wheelswitch can be edited by the user.- Returns:
- boolean
-
setEnhanced
public void setEnhanced(boolean enhanced) Sets the enhanced property of the wheelswitch. When enhanced the wheelswitch animates its digits when changing the value displayed.- See Also:
-
isEnhanced
public boolean isEnhanced()Gets the enhancement mode of theWheelswitch.- Returns:
- DOCUMENT ME!
-
setFormat
Sets the format of the value display. Format style is Wheelswitch specific.- Parameters:
newFormat-- Throws:
NullPointerException- DOCUMENT ME!- See Also:
-
getFormat
Gets the format of the display.- Returns:
- java.lang.String
- See Also:
-
setGraphMax
public void setGraphMax(double newValue) Sets the maximum allowed value.- Parameters:
newValue-- See Also:
-
getGraphMax
public double getGraphMax()Gets the maximum alowed value.- Returns:
- double
- See Also:
-
setGraphMin
public void setGraphMin(double newValue) Sets the minimum allowed value.- Parameters:
newValue-- See Also:
-
getGraphMin
public double getGraphMin()Gets the minimum alowed value.- Returns:
- double
- See Also:
-
setMaxMin
public void setMaxMin(double max, double min) Sets the maximum and minimum allowed values.- Parameters:
max-min-
-
getMinimumSize
This method has been overriden to implement correct layout and resizing features.- Overrides:
getMinimumSizein classJComponent- See Also:
-
getPreferredSize
This method has been overriden to implement correct layout and resizing features.- Overrides:
getPreferredSizein classJComponent- See Also:
-
setTiltingEnabled
public void setTiltingEnabled(boolean b) Sets the tilitng enabled property.- Parameters:
b- whether the component should tilt when value is out of bounds.
-
isTiltingEnabled
public boolean isTiltingEnabled()Returns whether the component should indicate value out of bounds condition by visually tilting its border.- Returns:
- boolean
-
setUnit
Sets the unit to be displayed next to the value.- Parameters:
newUnit-- See Also:
-
getUnit
Gets the unit displayed next to the value.- Returns:
- java.lang.String
- See Also:
-
setValue
public void setValue(double newValue) Sets the value and displays it in the wheelswitch. The method may also change the current digit selection if neccessary in order to point to the same decimal digit of the displayed value.- Parameters:
newValue-- See Also:
-
getValue
public double getValue()Gets the value displayed by theWheelswitchand stored by theformatter.- Returns:
- double
- See Also:
-
setEnabled
public void setEnabled(boolean arg0) Overriden to implement digit and upDownButton enabling/disabling.- Overrides:
setEnabledin classJComponent- See Also:
-
setMaximumDigits
public void setMaximumDigits(int bound) Sets the maximum number of value digits allowed to be displayed in the wheelswitch. The default value is 0 and is ignored.- Parameters:
bound- is ignored if less or equal zero.
-
setDigitValue
protected void setDigitValue(int i, int newValue) -
setSelectedDigit
protected void setSelectedDigit(int i) -
getSelectedDigit
protected int getSelectedDigit() -
initDigits
protected void initDigits()
-