javax.swing

Class JSpinner.NumberEditor

public static class JSpinner.NumberEditor extends JSpinner.DefaultEditor

A panel containing a JFormattedTextField that is configured for displaying and editing numbers. The panel is used as a subcomponent of a JSpinner.

See Also: createEditor

Constructor Summary
NumberEditor(JSpinner spinner)
Creates a new NumberEditor object for the specified spinner.
NumberEditor(JSpinner spinner, String decimalFormatPattern)
Creates a new NumberEditor object.
Method Summary
DecimalFormatgetFormat()
Returns the format used by the text field.
SpinnerNumberModelgetModel()
Returns the model used by the editor's JSpinner component, cast to a SpinnerNumberModel.

Constructor Detail

NumberEditor

public NumberEditor(JSpinner spinner)
Creates a new NumberEditor object for the specified spinner. The editor is registered with the spinner as a ChangeListener.

Parameters: spinner the component the editor will be used with.

NumberEditor

public NumberEditor(JSpinner spinner, String decimalFormatPattern)
Creates a new NumberEditor object.

Parameters: spinner the spinner. decimalFormatPattern the number format pattern.

Method Detail

getFormat

public DecimalFormat getFormat()
Returns the format used by the text field.

Returns: The format used by the text field.

getModel

public SpinnerNumberModel getModel()
Returns the model used by the editor's JSpinner component, cast to a SpinnerNumberModel.

Returns: The model.