- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.text.JTextComponent
-
- javax.swing.JTextField
-
- javax.swing.JFormattedTextField
-
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, SwingConstants
public class JFormattedTextField extends JTextField
JFormattedTextField
extendsJTextField
adding support for formatting arbitrary values, as well as retrieving a particular object once the user has edited the text. The following illustrates configuring aJFormattedTextField
to edit dates:JFormattedTextField ftf = new JFormattedTextField(); ftf.setValue(new Date());
Once a
JFormattedTextField
has been created, you can listen for editing changes by way of adding aPropertyChangeListener
and listening forPropertyChangeEvent
s with the property namevalue
.JFormattedTextField
allows configuring what action should be taken when focus is lost. The possible configurations are:Value
Description
JFormattedTextField.REVERT Revert the display to match that of getValue
, possibly losing the current edit.JFormattedTextField.COMMIT Commits the current value. If the value being edited isn't considered a legal value by the AbstractFormatter
that is, aParseException
is thrown, then the value will not change, and then edited value will persist.JFormattedTextField.COMMIT_OR_REVERT Similar to COMMIT
, but if the value isn't legal, behave likeREVERT
.JFormattedTextField.PERSIST Do nothing, don't obtain a new AbstractFormatter
, and don't update the value.JFormattedTextField.COMMIT_OR_REVERT
, refer tosetFocusLostBehavior(int)
for more information on this.JFormattedTextField
allows the focus to leave, even if the currently edited value is invalid. To lock the focus down while theJFormattedTextField
is an invalid edit state you can attach anInputVerifier
. The following code snippet shows a potential implementation of such anInputVerifier
:public class FormattedTextFieldVerifier extends InputVerifier { public boolean verify(JComponent input) { if (input instanceof JFormattedTextField) { JFormattedTextField ftf = (JFormattedTextField)input; AbstractFormatter formatter = ftf.getFormatter(); if (formatter != null) { String text = ftf.getText(); try { formatter.stringToValue(text); return true; } catch (ParseException pe) { return false; } } } return true; } public boolean shouldYieldFocus(JComponent input) { return verify(input); } }
Alternatively, you could invoke
commitEdit
, which would also commit the value.JFormattedTextField
does not do the formatting it self, rather formatting is done through an instance ofJFormattedTextField.AbstractFormatter
which is obtained from an instance ofJFormattedTextField.AbstractFormatterFactory
. Instances ofJFormattedTextField.AbstractFormatter
are notified when they become active by way of theinstall
method, at which point theJFormattedTextField.AbstractFormatter
can install whatever it needs to, typically aDocumentFilter
. Similarly whenJFormattedTextField
no longer needs theAbstractFormatter
, it will invokeuninstall
.JFormattedTextField
typically queries theAbstractFormatterFactory
for anAbstractFormat
when it gains or loses focus. Although this can change based on the focus lost policy. If the focus lost policy isJFormattedTextField.PERSIST
and theJFormattedTextField
has been edited, theAbstractFormatterFactory
will not be queried until the value has been commited. Similarly if the focus lost policy isJFormattedTextField.COMMIT
and an exception is thrown fromstringToValue
, theAbstractFormatterFactory
will not be querired when focus is lost or gained.JFormattedTextField.AbstractFormatter
is also responsible for determining when values are commited to theJFormattedTextField
. SomeJFormattedTextField.AbstractFormatter
s will make new values available on every edit, and others will never commit the value. You can force the current value to be obtained from the currentJFormattedTextField.AbstractFormatter
by way of invokingcommitEdit
.commitEdit
will be invoked whenever return is pressed in theJFormattedTextField
.If an
AbstractFormatterFactory
has not been explicitly set, one will be set based on theClass
of the value type aftersetValue
has been invoked (assuming value is non-null). For example, in the following code an appropriateAbstractFormatterFactory
andAbstractFormatter
will be created to handle formatting of numbers:JFormattedTextField tf = new JFormattedTextField(); tf.setValue(new Number(100));
Warning: As the
AbstractFormatter
will typically install aDocumentFilter
on theDocument
, and aNavigationFilter
on theJFormattedTextField
you should not install your own. If you do, you are likely to see odd behavior in that the editing policy of theAbstractFormatter
will not be enforced.Warning: Swing is not thread safe. For more information see Swing's Threading Policy.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the
java.beans
package. Please seeXMLEncoder
.- Since:
- 1.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
JFormattedTextField.AbstractFormatter
Instances ofAbstractFormatter
are used byJFormattedTextField
to handle the conversion both from an Object to a String, and back from a String to an Object.static class
JFormattedTextField.AbstractFormatterFactory
Instances ofAbstractFormatterFactory
are used byJFormattedTextField
to obtain instances ofAbstractFormatter
which in turn are used to format values.-
Nested classes/interfaces inherited from class javax.swing.JTextField
JTextField.AccessibleJTextField
-
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBinding
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field and Description static int
COMMIT
Constant identifying that when focus is lost,commitEdit
should be invoked.static int
COMMIT_OR_REVERT
Constant identifying that when focus is lost,commitEdit
should be invoked.static int
PERSIST
Constant identifying that when focus is lost, the edited value should be left.static int
REVERT
Constant identifying that when focus is lost, editing value should be reverted to current value set on theJFormattedTextField
.-
Fields inherited from class javax.swing.JTextField
notifyAction
-
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
-
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, 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 javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
-
-
Constructor Summary
Constructors Constructor and Description JFormattedTextField()
Creates aJFormattedTextField
with noAbstractFormatterFactory
.JFormattedTextField(Format format)
Creates aJFormattedTextField
.JFormattedTextField(JFormattedTextField.AbstractFormatter formatter)
Creates aJFormattedTextField
with the specifiedAbstractFormatter
.JFormattedTextField(JFormattedTextField.AbstractFormatterFactory factory)
Creates aJFormattedTextField
with the specifiedAbstractFormatterFactory
.JFormattedTextField(JFormattedTextField.AbstractFormatterFactory factory, Object currentValue)
Creates aJFormattedTextField
with the specifiedAbstractFormatterFactory
and initial value.JFormattedTextField(Object value)
Creates a JFormattedTextField with the specified value.
-
Method Summary
Methods Modifier and Type Method and Description void
commitEdit()
Forces the current value to be taken from theAbstractFormatter
and set as the current value.Action[]
getActions()
Fetches the command list for the editor.int
getFocusLostBehavior()
Returns the behavior when focus is lost.JFormattedTextField.AbstractFormatter
getFormatter()
Returns theAbstractFormatter
that is used to format and parse the current value.JFormattedTextField.AbstractFormatterFactory
getFormatterFactory()
Returns the currentAbstractFormatterFactory
.String
getUIClassID()
Gets the class ID for a UI.Object
getValue()
Returns the last valid value.protected void
invalidEdit()
Invoked when the user inputs an invalid value.boolean
isEditValid()
Returns true if the current value being edited is valid.protected void
processFocusEvent(FocusEvent e)
Processes any focus events, such asFocusEvent.FOCUS_GAINED
orFocusEvent.FOCUS_LOST
.protected void
processInputMethodEvent(InputMethodEvent e)
Processes any input method events, such asInputMethodEvent.INPUT_METHOD_TEXT_CHANGED
orInputMethodEvent.CARET_POSITION_CHANGED
.void
setDocument(Document doc)
Associates the editor with a text document.void
setFocusLostBehavior(int behavior)
Sets the behavior when focus is lost.protected void
setFormatter(JFormattedTextField.AbstractFormatter format)
Sets the currentAbstractFormatter
.void
setFormatterFactory(JFormattedTextField.AbstractFormatterFactory tf)
Sets theAbstractFormatterFactory
.void
setValue(Object value)
Sets the value that will be formatted by anAbstractFormatter
obtained from the currentAbstractFormatterFactory
.-
Methods inherited from class javax.swing.JTextField
actionPropertyChanged, addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setFont, setHorizontalAlignment, setScrollOffset
-
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, 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, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, restoreComposedText, saveComposedText, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, write
-
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, 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, setEnabled, setFocusTraversalKeys, setForeground, 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, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, 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, 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, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
COMMIT
public static final int COMMIT
Constant identifying that when focus is lost,commitEdit
should be invoked. If in commiting the new value aParseException
is thrown, the invalid value will remain.
-
COMMIT_OR_REVERT
public static final int COMMIT_OR_REVERT
Constant identifying that when focus is lost,commitEdit
should be invoked. If in commiting the new value aParseException
is thrown, the value will be reverted.
-
REVERT
public static final int REVERT
Constant identifying that when focus is lost, editing value should be reverted to current value set on theJFormattedTextField
.
-
PERSIST
public static final int PERSIST
Constant identifying that when focus is lost, the edited value should be left.
-
-
Constructor Detail
-
JFormattedTextField
public JFormattedTextField()
Creates aJFormattedTextField
with noAbstractFormatterFactory
. UsesetMask
orsetFormatterFactory
to configure theJFormattedTextField
to edit a particular type of value.
-
JFormattedTextField
public JFormattedTextField(Object value)
Creates a JFormattedTextField with the specified value. This will create anAbstractFormatterFactory
based on the type ofvalue
.- Parameters:
value
- Initial value for the JFormattedTextField
-
JFormattedTextField
public JFormattedTextField(Format format)
Creates aJFormattedTextField
.format
is wrapped in an appropriateAbstractFormatter
which is then wrapped in anAbstractFormatterFactory
.- Parameters:
format
- Format used to look up an AbstractFormatter
-
JFormattedTextField
public JFormattedTextField(JFormattedTextField.AbstractFormatter formatter)
Creates aJFormattedTextField
with the specifiedAbstractFormatter
. TheAbstractFormatter
is placed in anAbstractFormatterFactory
.- Parameters:
formatter
- AbstractFormatter to use for formatting.
-
JFormattedTextField
public JFormattedTextField(JFormattedTextField.AbstractFormatterFactory factory)
Creates aJFormattedTextField
with the specifiedAbstractFormatterFactory
.- Parameters:
factory
- AbstractFormatterFactory used for formatting.
-
JFormattedTextField
public JFormattedTextField(JFormattedTextField.AbstractFormatterFactory factory, Object currentValue)
Creates aJFormattedTextField
with the specifiedAbstractFormatterFactory
and initial value.- Parameters:
factory
-AbstractFormatterFactory
used for formatting.currentValue
- Initial value to use
-
-
Method Detail
-
setFocusLostBehavior
public void setFocusLostBehavior(int behavior)
Sets the behavior when focus is lost. This will be one ofJFormattedTextField.COMMIT_OR_REVERT
,JFormattedTextField.REVERT
,JFormattedTextField.COMMIT
orJFormattedTextField.PERSIST
Note that someAbstractFormatter
s may push changes as they occur, so that the value of this will have no effect.This will throw an
IllegalArgumentException
if the object passed in is not one of the afore mentioned values.The default value of this property is
JFormattedTextField.COMMIT_OR_REVERT
.- Parameters:
behavior
- Identifies behavior when focus is lost- Throws:
IllegalArgumentException
- if behavior is not one of the known values
-
getFocusLostBehavior
public int getFocusLostBehavior()
Returns the behavior when focus is lost. This will be one ofCOMMIT_OR_REVERT
,COMMIT
,REVERT
orPERSIST
Note that someAbstractFormatter
s may push changes as they occur, so that the value of this will have no effect.- Returns:
- returns behavior when focus is lost
-
setFormatterFactory
public void setFormatterFactory(JFormattedTextField.AbstractFormatterFactory tf)
Sets theAbstractFormatterFactory
.AbstractFormatterFactory
is able to return an instance ofAbstractFormatter
that is used to format a value for display, as well an enforcing an editing policy.If you have not explicitly set an
AbstractFormatterFactory
by way of this method (or a constructor) anAbstractFormatterFactory
and consequently anAbstractFormatter
will be used based on theClass
of the value.NumberFormatter
will be used forNumber
s,DateFormatter
will be used forDates
, otherwiseDefaultFormatter
will be used.This is a JavaBeans bound property.
- Parameters:
tf
-AbstractFormatterFactory
used to lookup instances ofAbstractFormatter
-
getFormatterFactory
public JFormattedTextField.AbstractFormatterFactory getFormatterFactory()
Returns the currentAbstractFormatterFactory
.- Returns:
AbstractFormatterFactory
used to determineAbstractFormatter
s- See Also:
setFormatterFactory(javax.swing.JFormattedTextField.AbstractFormatterFactory)
-
setFormatter
protected void setFormatter(JFormattedTextField.AbstractFormatter format)
Sets the currentAbstractFormatter
.You should not normally invoke this, instead set the
AbstractFormatterFactory
or set the value.JFormattedTextField
will invoke this as the state of theJFormattedTextField
changes and requires the value to be reset.JFormattedTextField
passes in theAbstractFormatter
obtained from theAbstractFormatterFactory
.This is a JavaBeans bound property.
- Parameters:
format
- AbstractFormatter to use for formatting- See Also:
setFormatterFactory(javax.swing.JFormattedTextField.AbstractFormatterFactory)
-
getFormatter
public JFormattedTextField.AbstractFormatter getFormatter()
Returns theAbstractFormatter
that is used to format and parse the current value.- Returns:
- AbstractFormatter used for formatting
-
setValue
public void setValue(Object value)
Sets the value that will be formatted by anAbstractFormatter
obtained from the currentAbstractFormatterFactory
. If noAbstractFormatterFactory
has been specified, this will attempt to create one based on the type ofvalue
.The default value of this property is null.
This is a JavaBeans bound property.
- Parameters:
value
- Current value to display
-
getValue
public Object getValue()
Returns the last valid value. Based on the editing policy of theAbstractFormatter
this may not return the current value. The currently edited value can be obtained by invokingcommitEdit
followed bygetValue
.- Returns:
- Last valid value
-
commitEdit
public void commitEdit() throws ParseException
Forces the current value to be taken from theAbstractFormatter
and set as the current value. This has no effect if there is no currentAbstractFormatter
installed.- Throws:
ParseException
- if theAbstractFormatter
is not able to format the current value
-
isEditValid
public boolean isEditValid()
Returns true if the current value being edited is valid. The value of this is managed by the currentAbstractFormatter
, as such there is no public setter for it.- Returns:
- true if the current value being edited is valid.
-
invalidEdit
protected void invalidEdit()
Invoked when the user inputs an invalid value. This gives the component a chance to provide feedback. The default implementation beeps.
-
processInputMethodEvent
protected void processInputMethodEvent(InputMethodEvent e)
Processes any input method events, such asInputMethodEvent.INPUT_METHOD_TEXT_CHANGED
orInputMethodEvent.CARET_POSITION_CHANGED
.- Overrides:
processInputMethodEvent
in classJTextComponent
- Parameters:
e
- theInputMethodEvent
- See Also:
InputMethodEvent
-
processFocusEvent
protected void processFocusEvent(FocusEvent e)
Processes any focus events, such asFocusEvent.FOCUS_GAINED
orFocusEvent.FOCUS_LOST
.- Overrides:
processFocusEvent
in classComponent
- Parameters:
e
- theFocusEvent
- See Also:
FocusEvent
-
getActions
public Action[] getActions()
Fetches the command list for the editor. This is the list of commands supported by the plugged-in UI augmented by the collection of commands that the editor itself supports. These are useful for binding to events, such as in a keymap.- Overrides:
getActions
in classJTextField
- Returns:
- the command list
-
getUIClassID
public String getUIClassID()
Gets the class ID for a UI.- Overrides:
getUIClassID
in classJTextField
- Returns:
- the string "FormattedTextFieldUI"
- See Also:
JComponent.getUIClassID()
-
setDocument
public void setDocument(Document doc)
Associates the editor with a text document. The currently registered factory is used to build a view for the document, which gets displayed by the editor after revalidation. A PropertyChange event ("document") is propagated to each listener.- Overrides:
setDocument
in classJTextField
- Parameters:
doc
- the document to display/edit- See Also:
JTextComponent.getDocument()
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/swing/jformattedtextfield.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.