public class G9TextField extends JTextField implements G9ValueState, G9FieldValue
JTextField.AccessibleJTextFieldJTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBindingJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
protected EventListenerList |
vcListeners
List of value changed listeners
|
notifyActionDEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEYlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTBOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WESTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
G9TextField()
Constructs a new
G9TextField. |
G9TextField(Document doc,
String text,
int columns)
Constructs a new
G9TextField that uses the given text
storage model and the given number of columns. |
G9TextField(int columns)
Constructs a new empty
G9TextField with the specified
number of columns. |
G9TextField(String text)
Constructs a new
G9TextField initialized with the
specified text. |
G9TextField(String text,
int columns)
Constructs a new
G9TextField initialized with the
specified text and columns. |
| Modifier and Type | Method and Description |
|---|---|
void |
addValueChangedListener(G9ValueChangedListener listener)
Adds a change listener to this component.
|
void |
display(Object value)
Updates the displayed value of the component, without
affecting the state of the component.
|
protected void |
fireG9ValueChangedEvent(int id,
Object oldValue,
Object newValue)
Fires a g9 value changed event.
|
String |
format() |
Object |
getInitialValue()
Returns the initial displayed value.
|
Object |
getValue()
Try creating a new value by parsing the displayed text according to the
output format.
|
boolean |
isChanged()
Checks if the currently displayed value is the same as the initial
value.
|
boolean |
isSelectAllOnFocus()
If the selectAllOnFocus property is
true the displayed text
is selected each time this component gains focus. |
Object |
parse(Object o)
Parses the specified object
|
Object |
parse(String formattedString)
Returns a value object.
|
void |
resetState()
Forces the currently displayed text to be considered the old text.
|
void |
setDocument(Document doc) |
void |
setEditable(boolean editable) |
void |
setEnabled(boolean enable) |
void |
setInitialValue(Object value)
Sets the initial value to be the specified value.
|
void |
setInputJustification(int justification)
Sets the input justification of this component
|
void |
setOutputJustification(int justification)
Sets the output justifiaction of this component
|
void |
setSelectAllOnFocus(boolean selectAllOnFocus)
If the selectAllOnFocus property is
true the displayed text
is selected each time this component gains focus. |
void |
setText(String s) |
void |
setValue(Object value)
Set the documents new value.
|
String |
toString() |
actionPropertyChanged, addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setFont, setHorizontalAlignment, setScrollOffsetaddCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, restoreComposedText, saveComposedText, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, writeaddAncestorListener, 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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, 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, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, 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, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycleprotected EventListenerList vcListeners
public G9TextField()
G9TextField. A default model is
created, the initial string is null, and the number of
columns is set to 0.public G9TextField(String text)
G9TextField initialized with the
specified text. A default model is created and the number of columns is
0.text - the text to be displayed, or nullpublic G9TextField(int columns)
G9TextField with the specified
number of columns. A default model is created and the initial string is
set to null.columns - the number of columns to use to calculate the preferred
width; if columns is set to zero, the preferred width will be
whatever naturally results from the component implementationpublic G9TextField(String text, int columns)
G9TextField initialized with the
specified text and columns. A default model is created.text - the text to be displayed, or nullcolumns - the number of columns to use to calculate the preferred
width; if columns is set to zero, the preferred width will be
whatever naturally results from the component implementationpublic G9TextField(Document doc, String text, int columns)
G9TextField that uses the given text
storage model and the given number of columns. This is the constructor
through which the other constructors feed. If the document is
null, a default model is created.doc - the text storage to use; if this is null, a
default will be provided by calling the
createDefaultModel methodtext - the initial string to display, or nullcolumns - the number of columns to use to calculate the preferred
width >= 0; if columns is set to zero, the
preferred width will be whatever naturally results from the
component implementationIllegalArgumentException - if columns < 0public void setDocument(Document doc)
setDocument in class JTextFieldpublic void resetState()
resetState in interface G9ValueStatepublic void setEnabled(boolean enable)
setEnabled in class JComponentpublic void setEditable(boolean editable)
setEditable in class JTextComponentpublic void addValueChangedListener(G9ValueChangedListener listener)
G9ValueStateaddValueChangedListener in interface G9ValueStatelistener - the listener to addprotected void fireG9ValueChangedEvent(int id,
Object oldValue,
Object newValue)
id - the type of eventoldValue - the old valuenewValue - the new valuepublic boolean isChanged()
G9ValueStateisChanged in interface G9ValueStatetrue if the displayed value differs from the
initial value.public void display(Object value)
G9ValueStatedisplay in interface G9ValueStatevalue - the new value to displaypublic void setText(String s)
setText in class JTextComponentpublic Object getInitialValue()
G9ValueStategetInitialValue in interface G9ValueStatepublic void setInitialValue(Object value)
G9ValueStatesetInitialValue in interface G9ValueStatevalue - the (new) initial value.public void setInputJustification(int justification)
justification - the input justificationpublic void setOutputJustification(int justification)
justification - the output justificationpublic void setValue(Object value)
setValue in interface G9FieldValuevalue - (missing javadoc)public Object getValue()
getValue in interface G9FieldValuepublic String format()
format in interface G9FieldValuepublic Object parse(String formattedString)
G9FieldValueparse in interface G9FieldValueformattedString - (missing javadoc)public Object parse(Object o)
o - the object to parsepublic boolean isSelectAllOnFocus()
true the displayed text
is selected each time this component gains focus.public void setSelectAllOnFocus(boolean selectAllOnFocus)
true the displayed text
is selected each time this component gains focus.selectAllOnFocus - The selectAllOnFocus property.Copyright © 2006–2018 Esito AS. All rights reserved.