- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- javax.swing.JSpinner.DefaultEditor
-
- javax.swing.JSpinner.NumberEditor
-
- All Implemented Interfaces:
-
ImageObserver
,LayoutManager
,MenuContainer
,PropertyChangeListener
,Serializable
,EventListener
,Accessible
,ChangeListener
- Enclosing class:
- JSpinner
public static class JSpinner.NumberEditor extends JSpinner.DefaultEditor
一个JSpinner
的编辑器,其型号是SpinnerNumberModel
。 编辑器的值显示为JFormattedTextField
其格式由NumberFormatter
实例定义,其minimum
和maximum
属性映射到SpinnerNumberModel
。- 从以下版本开始:
- 1.4
- 另请参见:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
-
Field Summary
-
Fields inherited from class java.awt.Component
accessibleContext, 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
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
构造方法摘要
构造方法 Constructor 描述 NumberEditor(JSpinner spinner)
构造一个JSpinner
编辑器,支持显示和编辑一个SpinnerNumberModel
的值,一个JFormattedTextField
。NumberEditor(JSpinner spinner, String decimalFormatPattern)
构造一个JSpinner
编辑器,支持显示和编辑一个SpinnerNumberModel
的值,一个JFormattedTextField
。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 DecimalFormat
getFormat()
返回java.text.DecimalFormat
对象JFormattedTextField
用于解析和格式化数字。SpinnerNumberModel
getModel()
返回我们的旋转器祖先的SpinnerNumberModel
。void
setComponentOrientation(ComponentOrientation o)
设置用于对该组件中的元素或文本进行排序的语言敏感方向。-
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, 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, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
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 javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JSpinner.DefaultEditor
addLayoutComponent, commitEdit, dismiss, getBaseline, getBaselineResizeBehavior, getSpinner, getTextField, layoutContainer, minimumLayoutSize, preferredLayoutSize, propertyChange, removeLayoutComponent, stateChanged
-
-
-
-
构造方法详细信息
-
NumberEditor
public NumberEditor(JSpinner spinner)
构造一个JSpinner
编辑器,支持显示和编辑的价值SpinnerNumberModel
用JFormattedTextField
。This
NumberEditor
成为一个ChangeListener
在微调和PropertyChangeListener
在新的JFormattedTextField
。- 参数
-
spinner
-this
编辑器将监控的微调器 - 异常
-
IllegalArgumentException
- 如果纺纱机型号不是SpinnerNumberModel
的实例 - 另请参见:
-
getModel()
,getFormat()
,SpinnerNumberModel
-
NumberEditor
public NumberEditor(JSpinner spinner, String decimalFormatPattern)
构造一个JSpinner
编辑器,支持显示和编辑一个SpinnerNumberModel
的值,一个JFormattedTextField
。This
NumberEditor
成为一个ChangeListener
上的微调和一个PropertyChangeListener
在新的JFormattedTextField
。- 参数
-
spinner
-this
编辑器将监控的微调器 -
decimalFormatPattern
-DecimalFormat
对象的初始模式,用于显示和解析文本字段的值。 - 异常
-
IllegalArgumentException
-如果微调器模型不是一个实例SpinnerNumberModel
或者decimalFormatPattern
不是一个法律论据DecimalFormat
- 另请参见:
-
JSpinner.DefaultEditor.getTextField()
,SpinnerNumberModel
,DecimalFormat
-
-
方法详细信息
-
getFormat
public DecimalFormat getFormat()
返回java.text.DecimalFormat
对象JFormattedTextField
用于解析和格式化数字。- 结果
-
价值
getTextField().getFormatter().getFormat()
。 - 另请参见:
-
JSpinner.DefaultEditor.getTextField()
,DecimalFormat
-
getModel
public SpinnerNumberModel getModel()
返回我们的旋转器祖先的SpinnerNumberModel
。- 结果
-
getSpinner().getModel()
- 另请参见:
-
JSpinner.DefaultEditor.getSpinner()
,JSpinner.DefaultEditor.getTextField()
-
setComponentOrientation
public void setComponentOrientation(ComponentOrientation o)
设置用于对该组件中的元素或文本进行排序的语言敏感方向。 语言敏感的LayoutManager
和Component
子类将使用此属性来确定如何布局和绘制组件。在施工时,组件的方向设置为
ComponentOrientation.UNKNOWN
,表示尚未明确指定。 UNKNOWN方向的行为与ComponentOrientation.LEFT_TO_RIGHT
相同。要设置单个组件的方向,请使用此方法。 要设置整个组件层次结构的方向,请使用
applyComponentOrientation
。该方法更改布局相关信息,因此使组件层次结构无效。
- 重写:
-
setComponentOrientation
在Component
- 参数
-
o
- 要设置的方向 - 另请参见:
-
ComponentOrientation
,Component.invalidate()
-
-