Module java.desktop
Package javax.swing

Class JSpinner.DefaultEditor

java.lang.Object
All Implemented Interfaces:
ImageObserver, LayoutManager, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, ChangeListener
Direct Known Subclasses:
JSpinner.DateEditor, JSpinner.ListEditor, JSpinner.NumberEditor
Enclosing class:
JSpinner

public static class JSpinner.DefaultEditor extends JPanel implements ChangeListener, PropertyChangeListener, LayoutManager
A simple base class for more specialized editors that displays a read-only view of the model's current value with a JFormattedTextField. Subclasses can configure the JFormattedTextField to create an editor that's appropriate for the type of model they support and they may want to override the stateChanged and propertyChanged methods, which keep the model and the text field in sync.

This class defines a dismiss method that removes the editors ChangeListener from the JSpinner that it's part of. The setEditor method knows about DefaultEditor.dismiss, so if the developer replaces an editor that's derived from JSpinner.DefaultEditor its ChangeListener connection back to the JSpinner will be removed. However after that, it's up to the developer to manage their editor listeners. Similarly, if a subclass overrides createEditor, it's up to the subclasser to deal with their editor subsequently being replaced (with setEditor). We expect that in most cases, and in editor installed with setEditor or created by a createEditor override, will not be replaced anyway.

This class is the LayoutManager for it's single JFormattedTextField child. By default the child is just centered with the parents insets.

Since:
1.4