|
||||||||||
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 javax.swing.JPanel com.cosylab.gui.components.Wheelswitch
public class Wheelswitch
Descedant of javax.swing.JPanel
that contains a row of digits
and optionally a two way up-down buttons. It can be used for displaying and
modifying a single formatted double
value with an optional
unit string (also in digits) displyed next to the value. Value manipulation
and display formatting is handled by the WheelswitchFormatter
.
Digit
,
WheelswitchFormatter
,
Serialized FormNested Class Summary | |
---|---|
protected class |
Wheelswitch.KeyHandler
An implementation of KeyListener used for handling key commands for the wheelswitch. |
protected class |
Wheelswitch.MouseHandler
An implementation of KeyListener used for handling key commands for the wheelswitch. |
protected class |
Wheelswitch.TiltHandler
An extension of Timer used for periodic tilting of the Wheelswitch. |
protected class |
Wheelswitch.UpDownActionHandler
An implementation of ActionListener used for handling events from the up-down button in the wheelswitch. |
protected class |
Wheelswitch.WheelSwitchMouseHandler
An implementation of the MouseWheelListener used for handling mouse wheel events inside the wheelswitch. |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
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 |
DECREASE_SELECTION
|
static java.lang.String |
EDITABLE
Tag for editable property |
protected Wheelswitch.WheelSwitchMouseHandler |
handler
|
static java.lang.String |
HORIZONTAL_ALIGNMENT
Constant string representing the property name of horizontal alignment. |
protected static int |
INCREASE_SELECTION
|
protected Wheelswitch.KeyHandler |
keyHandler
|
protected javax.swing.event.EventListenerList |
listenerList
|
protected Wheelswitch.MouseHandler |
mouseHandler
|
protected Wheelswitch.TiltHandler |
tiltHandler
|
static java.lang.String |
VALUE
Tag for value property. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, 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 | |
---|---|
Wheelswitch()
Constructor for Wheelswitch which sets no format or unit and the value is set to zero. |
|
Wheelswitch(double newValue)
Constructor for Wheelswitch setting only the value. |
|
Wheelswitch(java.lang.String newFormat,
double newValue,
java.lang.String newUnit)
Constructor for Wheelswitch creates a new Wheelswitch with
the specified value, format and unit. |
Method Summary | |
---|---|
void |
addSetListener(SetListener l)
Adds an SetListener to the array of listeners currently
registered for listening to the value sets of the
Wheelswitch . |
protected void |
fireSetPerformed(double newValue)
Fires a SetEvent to all currently
registered SetListener s of the Wheelswitch . |
boolean |
getDigitsTakeUpAllSpace()
|
java.lang.String |
getFormat()
Gets the format of the display. |
AbstractWheelswitchFormatter |
getFormatter()
Returns the formatter employed by the wheelswitch |
double |
getGraphMax()
Gets the maximum alowed value. |
double |
getGraphMin()
Gets the minimum alowed value. |
java.awt.Dimension |
getMinimumSize()
|
int |
getNumberOfAllDigits()
|
PopupManager |
getPopupManager()
Returns popup manager, which manages popup menu. |
java.awt.Dimension |
getPreferredSize()
|
protected int |
getSelectedDigit()
Returns the currently selected digit. |
java.lang.String |
getUnit()
Gets the unit displayed next to the value. |
int |
getUnitsMaximumFontSize()
Returns the maximum font size of the units label. |
int |
getUnitsMinimumFontSize()
Returns the minimum font size of the units label. |
double |
getValue()
Returns the value displayed by the Wheelswitch and stored by
the formatter . |
protected void |
initDigits()
(Re)initializes existing value digits inside the wheelswitch. |
boolean |
isAnimated()
Determines wether currently the wheelswitch digits are animeted (scrolling) or not. |
boolean |
isEditable()
Returns whether the wheelswitch can be edited by the user. |
boolean |
isEnhanced()
Gets the enhancement mode of the Wheelswitch . |
boolean |
isPopupEnabled()
Return true if the popup menu is enabled or false otherwise. |
boolean |
isTiltingEnabled()
Returns whether the component should indicate value out of bounds condition by visually tilting its border. |
boolean |
isUnitSeparate()
Returns true if units are displayed in a separate label. |
static void |
main(java.lang.String[] args)
|
void |
removeSetListener(SetListener l)
Removes an SetListener from the array of listeners
currently registered for listening to the value sets of the
Wheelswitch . |
void |
setAnimated(boolean b)
Sets the animation property of wheelswith digits. |
void |
setBackground(java.awt.Color bg)
|
void |
setDigitsTakeUpAllSpace(boolean bool)
Set true if digits should take up all space, set
false if place for not visible digits should be reserved
(there is no resizing of digits when 9 changes to 10 etc.). |
protected void |
setDigitValue(int i,
int newValue)
Sets the value at the i-th digit |
void |
setEditable(boolean newEditable)
Sets the editability of the wheelswitch. |
void |
setEnabled(boolean arg0)
|
void |
setEnhanced(boolean enhanced)
Sets the enhanced property of the wheelswitch. |
void |
setForeground(java.awt.Color fg)
|
void |
setFormat(java.lang.String newFormat)
Sets the format of the value display. |
void |
setFormatter(AbstractWheelswitchFormatter formatter)
Sets the formatter which handles the values set to the wheelswitch. |
void |
setGraphMax(double newValue)
Sets the maximum allowed value. |
void |
setGraphMin(double newValue)
Sets the minimum allowed value. |
void |
setMaximumDigits(int bound)
Sets the maximum number of value digits allowed to be displayed in the wheelswitch. |
void |
setMaxMin(double max,
double min)
Sets the maximum and minimum allowed values. |
void |
setNumberOfAllDigits(int numberOfAllDigits)
If setDigitsTakeUpAllSpace(boolean) is set to false
the place for numberOfAllDigits is reserved. |
void |
setPopupEnabled(boolean enabled)
Enables or disables the popup menu. |
protected void |
setSelectedDigit(int i)
Sets a new Digit selection. |
void |
setTiltingEnabled(boolean b)
Sets the tilitng enabled property. |
void |
setUnit(java.lang.String newUnit)
Sets the unit to be displayed next to the value. |
void |
setUnitSeparate(boolean unitSeparate)
Sets weather the unit should be displayed in a separate label on the right of the component. |
void |
setUnitsMaximumFontSize(int max)
Sets the maximum font size for the units label. |
void |
setUnitsMinimumFontSize(int min)
Sets the minimum font size for the units label. |
protected void |
setupLayout()
Repositions the components inside the wheelswitch. |
protected void |
setupUnitDigits()
Constructs unit digits from scratch. |
protected void |
setupValueDigits()
Contructs value digits from scratch. |
void |
setValue(double newValue)
Sets the value and displays it in the wheelswitch. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
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 |
---|
protected static int INCREASE_SELECTION
protected static int DECREASE_SELECTION
public static final java.lang.String VALUE
public static final java.lang.String EDITABLE
protected javax.swing.event.EventListenerList listenerList
protected Wheelswitch.KeyHandler keyHandler
protected Wheelswitch.MouseHandler mouseHandler
protected Wheelswitch.TiltHandler tiltHandler
protected Wheelswitch.WheelSwitchMouseHandler handler
public static final java.lang.String HORIZONTAL_ALIGNMENT
Constructor Detail |
---|
public Wheelswitch(java.lang.String newFormat, double newValue, java.lang.String newUnit)
Wheelswitch
creates a new Wheelswitch with
the specified value, format and unit. No minimum or maximum values are
set.
newFormat
- newValue
- newUnit
- public Wheelswitch(double newValue)
Wheelswitch
setting only the value. No
format or unit are set.
newValue
- Wheelswitch(String, double, String)
public Wheelswitch()
Wheelswitch(String, double, String)
Method Detail |
---|
public PopupManager getPopupManager()
PopupManageable
getPopupManager
in interface PopupManageable
public boolean isPopupEnabled()
public void setPopupEnabled(boolean enabled)
enabled
- true if enable or false if disabledspublic void setEditable(boolean newEditable)
newEditable
- public boolean isEditable()
public void setEnhanced(boolean enhanced)
Digit.setEnhanced(boolean)
public boolean isEnhanced()
Wheelswitch
.
public void setFormat(java.lang.String newFormat)
newFormat
- new format (null not permitted)
java.lang.NullPointerException
- if paraeter is nullAbstractWheelswitchFormatter.setFormat(String)
public java.lang.String getFormat()
AbstractWheelswitchFormatter.getFormat()
public void setGraphMax(double newValue)
newValue
- new maximumAbstractWheelswitchFormatter.setMaximum(double)
public double getGraphMax()
AbstractWheelswitchFormatter.getMaximum()
public void setGraphMin(double newValue)
newValue
- new minimumAbstractWheelswitchFormatter.setMinimum(double)
public double getGraphMin()
AbstractWheelswitchFormatter.getMinimum()
public void setMaxMin(double max, double min)
max
- min
- public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public void setTiltingEnabled(boolean b)
b
- whether the component should tilt when value is out of bounds.public boolean isTiltingEnabled()
public void setUnit(java.lang.String newUnit)
newUnit
- new unitsAbstractWheelswitchFormatter.setUnit(String)
public java.lang.String getUnit()
AbstractWheelswitchFormatter.getUnit()
public void setValue(double newValue)
newValue
- new valueAbstractWheelswitchFormatter.setValue(double)
public double getValue()
Wheelswitch
and stored by
the formatter
.
AbstractWheelswitchFormatter.getValue()
public void addSetListener(SetListener l)
SetListener
to the array of listeners currently
registered for listening to the value sets of the
Wheelswitch
. These listeners are notified whenever the
user sets a new value.
l
- SetListener
public void setEnabled(boolean arg0)
setEnabled
in class javax.swing.JComponent
public void setMaximumDigits(int bound)
bound
- is ignored if less or equal zero.public void removeSetListener(SetListener l)
SetListener
from the array of listeners
currently registered for listening to the value sets of the
Wheelswitch
.
l
- protected void setDigitValue(int i, int newValue)
protected void setSelectedDigit(int i)
i
- new digit selection.protected int getSelectedDigit()
protected void fireSetPerformed(double newValue)
SetEvent
to all currently
registered SetListener
s of the Wheelswitch
.
protected void initDigits()
protected void setupLayout()
protected void setupUnitDigits()
protected void setupValueDigits()
public boolean isAnimated()
public void setAnimated(boolean b)
b
- public boolean isUnitSeparate()
public void setUnitSeparate(boolean unitSeparate)
unitSeparate
- The unitSeparate to set.public AbstractWheelswitchFormatter getFormatter()
public void setFormatter(AbstractWheelswitchFormatter formatter)
formatter
- new formattercom.cosylab.gui.components.wheelswtich.AbstractWheelswitchFormatter
public void setUnitsMaximumFontSize(int max)
max
- new maximum size in pixelspublic void setUnitsMinimumFontSize(int min)
min
- new minimum font size in pixelspublic int getUnitsMaximumFontSize()
public int getUnitsMinimumFontSize()
public void setBackground(java.awt.Color bg)
setBackground
in class javax.swing.JComponent
public void setForeground(java.awt.Color fg)
setForeground
in class javax.swing.JComponent
public void setDigitsTakeUpAllSpace(boolean bool)
true
if digits should take up all space, set
false
if place for not visible digits should be reserved
(there is no resizing of digits when 9 changes to 10 etc.).
Set the number of reserved place with setNumberOfAllDigits(int)
.
bool
- boolean valuepublic boolean getDigitsTakeUpAllSpace()
true
if digits take up all space,
otherwise false
public void setNumberOfAllDigits(int numberOfAllDigits)
setDigitsTakeUpAllSpace(boolean)
is set to false
the place for numberOfAllDigits
is reserved. Not needed
additional digits are not shown.
numberOfAllDigits
- number of all digitspublic int getNumberOfAllDigits()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |