public static class JSpinner.NumberEditor extends JSpinner.DefaultEditor
An editor for a JSpinner
whose model is a SpinnerNumberModel
. The value of the editor is displayed with a JFormattedTextField
whose format is defined by a NumberFormatter
instance whose minimum
and maximum
properties are mapped to the SpinnerNumberModel
.
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
public NumberEditor(JSpinner spinner)
Construct a JSpinner
editor that supports displaying and editing the value of a SpinnerNumberModel
with a JFormattedTextField
. This
NumberEditor
becomes both a ChangeListener
on the spinner and a PropertyChangeListener
on the new JFormattedTextField
.
spinner
- the spinner whose model this
editor will monitorIllegalArgumentException
- if the spinners model is not an instance of SpinnerNumberModel
getModel()
, getFormat()
, SpinnerNumberModel
public NumberEditor(JSpinner spinner, String decimalFormatPattern)
Construct a JSpinner
editor that supports displaying and editing the value of a SpinnerNumberModel
with a JFormattedTextField
. This
NumberEditor
becomes both a ChangeListener
on the spinner and a PropertyChangeListener
on the new JFormattedTextField
.
spinner
- the spinner whose model this
editor will monitordecimalFormatPattern
- the initial pattern for the DecimalFormat
object that's used to display and parse the value of the text field.IllegalArgumentException
- if the spinners model is not an instance of SpinnerNumberModel
or if decimalFormatPattern
is not a legal argument to DecimalFormat
JSpinner.DefaultEditor.getTextField()
, SpinnerNumberModel
, DecimalFormat
public DecimalFormat getFormat()
Returns the java.text.DecimalFormat
object the JFormattedTextField
uses to parse and format numbers.
getTextField().getFormatter().getFormat()
.JSpinner.DefaultEditor.getTextField()
, DecimalFormat
public SpinnerNumberModel getModel()
Return our spinner ancestor's SpinnerNumberModel
.
getSpinner().getModel()
JSpinner.DefaultEditor.getSpinner()
, JSpinner.DefaultEditor.getTextField()
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.