- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.text.JTextComponent
-
- javax.swing.JTextField
-
- javax.swing.JFormattedTextField
-
- 实现的所有接口
-
ImageObserver,MenuContainer,Serializable,Accessible,Scrollable,SwingConstants
@JavaBean public class JFormattedTextField extends JTextField
JFormattedTextField扩展JTextField添加了对格式化任意值的支持,以及在用户编辑文本后检索特定对象。 以下说明配置JFormattedTextField以编辑日期:JFormattedTextField ftf = new JFormattedTextField(); ftf.setValue(new Date());创建
JFormattedTextField,您可以通过添加PropertyChangeListener并使用属性名称value收听PropertyChangeEvent来监听编辑更改。
Possible JFormattedTextField configurations and their descriptions Value Description JFormattedTextField.REVERT Revert the display to match that ofJFormattedTextField允许配置丢失焦点时应采取的操作。 可能的配置是:getValue, possibly losing the current edit. JFormattedTextField.COMMIT Commits the current value. If the value being edited isn't considered a legal value by theAbstractFormatterthat is, aParseExceptionis thrown, then the value will not change, and then edited value will persist. JFormattedTextField.COMMIT_OR_REVERT Similar toCOMMIT, but if the value isn't legal, behave likeREVERT. JFormattedTextField.PERSIST Do nothing, don't obtain a newAbstractFormatter, and don't update the value.
默认值为JFormattedTextField.COMMIT_OR_REVERT,有关详细信息,请参阅setFocusLostBehavior(int)。JFormattedTextField允许焦点离开,即使当前编辑的值无效。 要在JFormattedTextField无效编辑状态时锁定焦点,可以附加InputVerifier。 以下代码段显示了此类InputVerifier的潜在实现: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); } }或者,您可以调用
commitEdit,它也会提交值。JFormattedTextField不自行格式化,而是通过JFormattedTextField.AbstractFormatter的实例完成格式化,该实例是从JFormattedTextField.AbstractFormatterFactory的实例获得的。JFormattedTextField.AbstractFormatter实例通过install方法激活时会通知实例,此时JFormattedTextField.AbstractFormatter可以安装所需的任何内容,通常为DocumentFilter。 同样当JFormattedTextField不再需要AbstractFormatter,它将调用uninstall。JFormattedTextField通常在获得或失去焦点时查询AbstractFormatterFactory以获取AbstractFormat。 虽然这可以根据焦点丢失政策而改变。 如果焦点丢失策略是JFormattedTextField.PERSIST和JFormattedTextField已经被编辑,该AbstractFormatterFactory不会被查询,直到该值已提交。 同样,如果焦点丢失策略为JFormattedTextField.COMMIT并且从stringToValue抛出异常,则在失去焦点或获得焦点时将不会查询AbstractFormatterFactory。JFormattedTextField.AbstractFormatter还负责确定何时将值提交给JFormattedTextField。 一些JFormattedTextField.AbstractFormatter将在每次编辑时提供新值,而其他人将永远不会提交该值。 您可以通过调用commitEdit从当前JFormattedTextField.AbstractFormatter获取当前值。commitEdit中按下返回时,将调用JFormattedTextField。如果
AbstractFormatterFactory尚未明确设置,一个将根据设置类值类型的后setValue已被调用(假设值为非空)。 例如,在以下代码中,将创建适当的AbstractFormatterFactory和AbstractFormatter来处理数字格式:JFormattedTextField tf = new JFormattedTextField(); tf.setValue(100);警告:由于
AbstractFormatter通常会安装一个DocumentFilter对Document和NavigationFilter的JFormattedTextField,你不应该自己安装。 如果这样做,您可能会看到奇怪的行为,因为AbstractFormatter的编辑策略将不会被强制执行。警告: Swing不是线程安全的。 有关更多信息,请参阅Swing's Threading Policy 。
警告:此类的序列化对象与以后的Swing版本不兼容。 当前的序列化支持适用于运行相同版本Swing的应用程序之间的短期存储或RMI。 从1.4开始,
java.beans软件包中添加了对所有JavaBeansjava.beans长期存储的支持。 请参阅XMLEncoder。- 从以下版本开始:
- 1.4
- 另请参见:
- Serialized Form
-
-
嵌套类汇总
嵌套类 变量和类型 类 描述 static classJFormattedTextField.AbstractFormatterAbstractFormatter实例使用JFormattedTextField来处理从Object到String的转换,以及从String转换为Object的转换。static classJFormattedTextField.AbstractFormatterFactoryAbstractFormatterFactory使用JFormattedTextField实例来获取JFormattedTextField实例,AbstractFormatter这些实例又用于格式化值。-
嵌套类/接口声明在类 javax.swing.JTextField
JTextField.AccessibleJTextField
-
嵌套类/接口声明在类 javax.swing.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBinding
-
嵌套类/接口声明在类 javax.swing.JComponent
JComponent.AccessibleJComponent
-
嵌套类/接口声明在类 java.awt.Container
Container.AccessibleAWTContainer
-
-
字段汇总
字段 变量和类型 字段 描述 static intCOMMIT常量标识当焦点丢失时,应调用commitEdit。static intCOMMIT_OR_REVERT常量标识当焦点丢失时,应调用commitEdit。static intPERSIST常量识别当焦点丢失时,应保留编辑后的值。static intREVERT常量识别当焦点丢失时,编辑值应恢复为JFormattedTextField上设置的当前值。-
声明的属性在类 javax.swing.JTextField
notifyAction
-
声明的属性在类 javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
-
声明的属性在类 javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
声明的属性在类 java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields declared in interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Fields declared in 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
-
-
构造方法摘要
构造方法 构造器 描述 JFormattedTextField()创建JFormattedTextField,没有AbstractFormatterFactory。JFormattedTextField(Object value)创建具有指定值的JFormattedTextField。JFormattedTextField(Format format)创建一个JFormattedTextField。JFormattedTextField(JFormattedTextField.AbstractFormatter formatter)创建JFormattedTextField具有指定AbstractFormatter。JFormattedTextField(JFormattedTextField.AbstractFormatterFactory factory)创建JFormattedTextField具有指定AbstractFormatterFactory。JFormattedTextField(JFormattedTextField.AbstractFormatterFactory factory, Object currentValue)使用指定的AbstractFormatterFactory和初始值创建JFormattedTextField。
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 voidcommitEdit()强制从AbstractFormatter获取当前值并将其设置为当前值。Action[]getActions()获取编辑器的命令列表。intgetFocusLostBehavior()返回焦点丢失时的行为。JFormattedTextField.AbstractFormattergetFormatter()返回用于格式化和解析当前值的AbstractFormatter。JFormattedTextField.AbstractFormatterFactorygetFormatterFactory()返回当前的AbstractFormatterFactory。StringgetUIClassID()获取UI的类ID。ObjectgetValue()返回最后一个有效值。protected voidinvalidEdit()用户输入无效值时调用。booleanisEditValid()如果正在编辑的当前值有效,则返回true。protected voidprocessFocusEvent(FocusEvent e)处理任何焦点事件,例如FocusEvent.FOCUS_GAINED或FocusEvent.FOCUS_LOST。protected voidprocessInputMethodEvent(InputMethodEvent e)处理任何输入法事件,例如InputMethodEvent.INPUT_METHOD_TEXT_CHANGED或InputMethodEvent.CARET_POSITION_CHANGED。voidsetDocument(Document doc)将编辑器与文本文档关联。voidsetFocusLostBehavior(int behavior)设置焦点丢失时的行为。protected voidsetFormatter(JFormattedTextField.AbstractFormatter format)设置当前AbstractFormatter。voidsetFormatterFactory(JFormattedTextField.AbstractFormatterFactory tf)设置AbstractFormatterFactory。voidsetValue(Object value)设置将从当前AbstractFormatterFactory获得的AbstractFormatter格式化的值。-
声明方法的类 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
-
声明方法的类 javax.swing.text.JTextComponent
addCaretListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, modelToView2D, moveCaretPosition, paste, print, print, print, read, removeCaretListener, removeKeymap, replaceSelection, restoreComposedText, saveComposedText, select, selectAll, setCaret, setCaretColor, setCaretPosition, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, viewToModel2D, write
-
声明方法的类 javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, 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, 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, removeNotify, 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
-
声明方法的类 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
-
声明方法的类 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, 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, 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, processHierarchyBoundsEvent, processHierarchyEvent, 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
-
-
-
-
字段详细信息
-
COMMIT
public static final int COMMIT
常量标识当焦点丢失时,应调用commitEdit。 如果在提交新值时抛出ParseException,则将保留无效值。- 另请参见:
-
setFocusLostBehavior(int), 常数字段值
-
COMMIT_OR_REVERT
public static final int COMMIT_OR_REVERT
常量识别焦点丢失时,应调用commitEdit。 如果在提交新值时抛出ParseException,则该值将被还原。- 另请参见:
-
setFocusLostBehavior(int), 常数字段值
-
REVERT
public static final int REVERT
常量识别当焦点丢失时,编辑值应恢复为JFormattedTextField上设置的当前值。- 另请参见:
-
setFocusLostBehavior(int), 常数字段值
-
PERSIST
public static final int PERSIST
常量识别当焦点丢失时,应保留编辑后的值。- 另请参见:
-
setFocusLostBehavior(int), 常数字段值
-
-
构造方法详细信息
-
JFormattedTextField
public JFormattedTextField()
创建JFormattedTextField,没有AbstractFormatterFactory。 使用setMask或setFormatterFactory配置JFormattedTextField以编辑特定类型的值。
-
JFormattedTextField
public JFormattedTextField(Object value)
创建具有指定值的JFormattedTextField。 这将创建一个AbstractFormatterFactory基于类型value。- 参数
-
value- JFormattedTextField的初始值
-
JFormattedTextField
public JFormattedTextField(Format format)
创建一个JFormattedTextField。format包装在适当的AbstractFormatter,然后包装在AbstractFormatterFactory。- 参数
-
format- 用于查找AbstractFormatter的格式
-
JFormattedTextField
public JFormattedTextField(JFormattedTextField.AbstractFormatter formatter)
创建JFormattedTextField具有指定AbstractFormatter。AbstractFormatter为AbstractFormatterFactory。- 参数
-
formatter- 用于格式化的AbstractFormatter。
-
JFormattedTextField
public JFormattedTextField(JFormattedTextField.AbstractFormatterFactory factory)
创建JFormattedTextField具有指定AbstractFormatterFactory。- 参数
-
factory- 用于格式化的AbstractFormatterFactory。
-
JFormattedTextField
public JFormattedTextField(JFormattedTextField.AbstractFormatterFactory factory, Object currentValue)
使用指定的AbstractFormatterFactory和初始值创建JFormattedTextField。- 参数
-
factory-AbstractFormatterFactory用于格式化。 -
currentValue- 要使用的初始值
-
-
方法详细信息
-
setFocusLostBehavior
@BeanProperty(bound=false, enumerationValues={"JFormattedTextField.COMMIT","JFormattedTextField.COMMIT_OR_REVERT","JFormattedTextField.REVERT","JFormattedTextField.PERSIST"}, description="Behavior when component loses focus") public void setFocusLostBehavior(int behavior)
设置焦点丢失时的行为。 这将是一个JFormattedTextField.COMMIT_OR_REVERT,JFormattedTextField.REVERT,JFormattedTextField.COMMIT或JFormattedTextField.PERSIST注意一些AbstractFormatter,因为它们发生S可推动变化,从而使该值将没有任何效果。如果传入的对象不是上述值之一,则抛出
IllegalArgumentException。此属性的默认值为
JFormattedTextField.COMMIT_OR_REVERT。- 参数
-
behavior- 识别焦点丢失时的行为 - 异常
-
IllegalArgumentException- 如果行为不是已知值之一
-
getFocusLostBehavior
public int getFocusLostBehavior()
返回焦点丢失时的行为。 这将是一个COMMIT_OR_REVERT,COMMIT,REVERT或PERSIST注意一些AbstractFormatter,因为它们发生S可推动变化,从而使该值将没有任何效果。- 结果
- 当焦点丢失时返回行为
-
setFormatterFactory
@BeanProperty(visualUpdate=true, description="AbstractFormatterFactory, responsible for returning an AbstractFormatter that can format the current value.") public void setFormatterFactory(JFormattedTextField.AbstractFormatterFactory tf)
设置AbstractFormatterFactory。AbstractFormatterFactory能够返回用于格式化显示值的AbstractFormatter实例,以及强制执行编辑策略。如果您没有明确设置
AbstractFormatterFactory用此方法(或构造函数)的方式AbstractFormatterFactory,因此一个AbstractFormatter将根据使用类的价值。NumberFormatter将用于Numbers,DateFormatter将用于Dates,否则将使用DefaultFormatter。这是一个JavaBeans绑定属性。
- 参数
-
tf-AbstractFormatterFactory用于查找AbstractFormatter实例
-
getFormatterFactory
public JFormattedTextField.AbstractFormatterFactory getFormatterFactory()
返回当前的AbstractFormatterFactory。- 结果
-
AbstractFormatterFactory用于确定AbstractFormatters - 另请参见:
-
setFormatterFactory(javax.swing.JFormattedTextField.AbstractFormatterFactory)
-
setFormatter
protected void setFormatter(JFormattedTextField.AbstractFormatter format)
设置当前AbstractFormatter。您通常不应该调用它,而是设置
AbstractFormatterFactory或设置值。JFormattedTextField将调用此为一体的状态JFormattedTextField的变化和需要将重置值。JFormattedTextField传递AbstractFormatter获得的AbstractFormatterFactory。这是一个JavaBeans绑定属性。
- 参数
-
format- 用于格式化的AbstractFormatter - 另请参见:
-
setFormatterFactory(javax.swing.JFormattedTextField.AbstractFormatterFactory)
-
getFormatter
@BeanProperty(visualUpdate=true, description="TextFormatter, responsible for formatting the current value") public JFormattedTextField.AbstractFormatter getFormatter()
返回用于格式化和解析当前值的AbstractFormatter。- 结果
- AbstractFormatter用于格式化
-
setValue
@BeanProperty(visualUpdate=true, description="The value to be formatted.") public void setValue(Object value)
设置将从当前AbstractFormatterFactory获得的AbstractFormatter格式化的值。 如果未指定AbstractFormatterFactory,则将尝试根据value的类型创建一个。此属性的默认值为null。
这是一个JavaBeans绑定属性。
- 参数
-
value- 要显示的当前值
-
getValue
public Object getValue()
返回最后一个有效值。 根据AbstractFormatter的编辑政策,这可能不会返回当前值。 当前编辑的值可以通过调用能够得到commitEdit随后getValue。- 结果
- 上一个有效值
-
commitEdit
public void commitEdit() throws ParseException强制从AbstractFormatter获取当前值并将其设置为当前值。 如果没有安装当前的AbstractFormatter,则AbstractFormatter。- 异常
-
ParseException- 如果AbstractFormatter无法格式化当前值
-
isEditValid
@BeanProperty(bound=false) public boolean isEditValid()
如果正在编辑的当前值有效,则返回true。 它的值由当前的AbstractFormatter管理,因此没有公共设置器。- 结果
- 如果正在编辑的当前值有效,则为true。
-
invalidEdit
protected void invalidEdit()
用户输入无效值时调用。 这使组件有机会提供反馈。 默认实现发出哔哔声。
-
processInputMethodEvent
protected void processInputMethodEvent(InputMethodEvent e)
处理任何输入方法事件,例如InputMethodEvent.INPUT_METHOD_TEXT_CHANGED或InputMethodEvent.CARET_POSITION_CHANGED。- 重写:
-
processInputMethodEvent类Component - 参数
-
e-InputMethodEvent - 另请参见:
-
InputMethodEvent
-
processFocusEvent
protected void processFocusEvent(FocusEvent e)
处理任何焦点事件,例如FocusEvent.FOCUS_GAINED或FocusEvent.FOCUS_LOST。- 重写:
-
processFocusEventComponent - 参数
-
e-FocusEvent - 另请参见:
-
FocusEvent
-
getActions
@BeanProperty(bound=false) public Action[] getActions()
获取编辑器的命令列表。 这是插件UI支持的命令列表,由编辑器本身支持的命令集合增强。 这些对于绑定事件很有用,例如在键映射中。- 重写:
-
getActions类JTextField - 结果
- 命令列表
-
getUIClassID
@BeanProperty(bound=false) public String getUIClassID()
获取UI的类ID。- 重写:
-
getUIClassID类JTextField - 结果
- 字符串“FormattedTextFieldUI”
- 另请参见:
-
JComponent.getUIClassID()
-
setDocument
@BeanProperty(expert=true, description="the text document model") public void setDocument(Document doc)
将编辑器与文本文档关联。 当前注册的工厂用于构建文档的视图,在重新验证后由编辑器显示。 PropertyChange事件(“document”)传播到每个侦听器。- 重写:
-
setDocument在JTextField类 - 参数
-
doc- 要显示/编辑的文档 - 另请参见:
-
JTextComponent.getDocument()
-
-