|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectWidget
Control
Scrollable
Text
JValueField
JIntegerField
public class JIntegerField
A text field control to work with integer values. It can be constrained to positive values if desired.
Example of use:
int initialValue = ...
boolean allowNegatives = false;
JIntegerField control = new JIntegerField(initialValue, allowNegatives);
control.addValueChangedListener( new ValueChangedListener() {
public void onValueChanged( ValueChangedEvent ev ) {
System.out.println("The new value is " + ev.getValue());
}
});
Field Summary |
---|
Fields inherited from class Text |
---|
DELIMITER, LIMIT |
Fields inherited from class Control |
---|
handle |
Constructor Summary | |
---|---|
JIntegerField(Composite parent,
int style)
Creates a new text field that allows negative values and has an initial value of 0. |
|
JIntegerField(Composite parent,
int style,
boolean allowsNegative)
Creates a new text field with an initial value of 0. |
|
JIntegerField(Composite parent,
int style,
int value)
Creates a new text field that allows negative values and the given initial value. |
|
JIntegerField(Composite parent,
int style,
int value,
boolean allowNegative)
Creates a new text field with the given initial value. |
Method Summary | |
---|---|
int |
getValue()
Get the current value of this control. |
void |
modifyText(ModifyEvent arg0)
|
void |
setValue(int value)
Set the integer value of this control. |
void |
setValue(int value,
boolean publishEvent)
Set the integer value of this control, optionally skipping notification of the change to listeners. |
Methods inherited from class JValueField |
---|
addValueChangedListener, fireValueChangedEvent, removeValueChangedListener |
Methods inherited from class Text |
---|
addModifyListener, addSelectionListener, addVerifyListener, append, clearSelection, computeSize, computeTrim, copy, cut, getBorderWidth, getCaretLineNumber, getCaretLocation, getCaretPosition, getCharCount, getDoubleClickEnabled, getEchoChar, getEditable, getLineCount, getLineDelimiter, getLineHeight, getMessage, getOrientation, getSelection, getSelectionCount, getSelectionText, getTabs, getText, getText, getTextLimit, getTopIndex, getTopPixel, insert, paste, removeModifyListener, removeSelectionListener, removeVerifyListener, selectAll, setDoubleClickEnabled, setEchoChar, setEditable, setFont, setMessage, setOrientation, setRedraw, setSelection, setSelection, setSelection, setTabs, setText, setTextLimit, setTopIndex, showSelection |
Methods inherited from class Scrollable |
---|
getClientArea, getHorizontalBar, getVerticalBar |
Methods inherited from class Control |
---|
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFocus, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRegion, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update |
Methods inherited from class Widget |
---|
addDisposeListener, addListener, checkSubclass, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JIntegerField(Composite parent, int style)
public JIntegerField(Composite parent, int style, boolean allowsNegative)
allowNegative
- true if this field should allow negative values to
be entered; false if only positive values are allowedpublic JIntegerField(Composite parent, int style, int value)
value
- the initial value to displaypublic JIntegerField(Composite parent, int style, int value, boolean allowNegative)
value
- the initial value to displayallowNegative
- true if this field should allow negative values to
be entered; false if only positive values are allowedMethod Detail |
---|
public int getValue()
public void setValue(int value)
ValueChangedEvent
will be
published to all ValueChangedListeners
.
value
- the value to set
IllegalArgumentException
- if value
is negative but the field
only allows positive valuespublic void setValue(int value, boolean publishEvent)
This version is useful when two or more controls are synchronized (ie. changes to the value of one control results in changes to the values of other controls). In such a setting, firing change events can result in an endless cycle or a mutex violation.
value
- the value to setpublishEvent
- true to notify listeners of this change; false to skip
notification
IllegalArgumentException
- if value
is negative but the field
only allows positive valuespublic void modifyText(ModifyEvent arg0)
modifyText
in interface ModifyListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |