javax.swing

Class JSpinner.NumberEditor

public static class JSpinner.NumberEditor extends JSpinner.DefaultEditor

A panel containing a {@link JFormattedTextField} that is configured for displaying and editing numbers. The panel is used as a subcomponent of a {@link 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 {@link JSpinner} component, cast to a {@link 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 {@link 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 {@link JSpinner} component, cast to a {@link SpinnerNumberModel}.

Returns: The model.