W3cubDocs

/OpenJDK 8 GUI

Class JSpinner.DateEditor

All Implemented Interfaces:
ImageObserver, LayoutManager, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, ChangeListener
Enclosing class:
JSpinner
public static class JSpinner.DateEditor
extends JSpinner.DefaultEditor

An editor for a JSpinner whose model is a SpinnerDateModel. The value of the editor is displayed with a JFormattedTextField whose format is defined by a DateFormatter instance whose minimum and maximum properties are mapped to the SpinnerDateModel.

Since:
1.4

Nested Classes

Nested classes/interfaces inherited from class javax.swing.JPanel

JPanel.AccessibleJPanel

Nested classes/interfaces inherited from class javax.swing.JComponent

JComponent.AccessibleJComponent

Nested classes/interfaces inherited from class java.awt.Container

Container.AccessibleAWTContainer

Nested classes/interfaces inherited from class java.awt.Component

Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy

Fields

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

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

Constructors

DateEditor

public DateEditor(JSpinner spinner)

Construct a JSpinner editor that supports displaying and editing the value of a SpinnerDateModel with a JFormattedTextField. This DateEditor becomes both a ChangeListener on the spinners model and a PropertyChangeListener on the new JFormattedTextField.

Parameters:
spinner - the spinner whose model this editor will monitor
Throws:
IllegalArgumentException - if the spinners model is not an instance of SpinnerDateModel
See Also:
getModel(), getFormat(), SpinnerDateModel

DateEditor

public DateEditor(JSpinner spinner,
                  String dateFormatPattern)

Construct a JSpinner editor that supports displaying and editing the value of a SpinnerDateModel with a JFormattedTextField. This DateEditor becomes both a ChangeListener on the spinner and a PropertyChangeListener on the new JFormattedTextField.

Parameters:
spinner - the spinner whose model this editor will monitor
dateFormatPattern - the initial pattern for the SimpleDateFormat object that's used to display and parse the value of the text field.
Throws:
IllegalArgumentException - if the spinners model is not an instance of SpinnerDateModel
See Also:
getModel(), getFormat(), SpinnerDateModel, SimpleDateFormat

Methods

getFormat

public SimpleDateFormat getFormat()

Returns the java.text.SimpleDateFormat object the JFormattedTextField uses to parse and format numbers.

Returns:
the value of getTextField().getFormatter().getFormat().
See Also:
JSpinner.DefaultEditor.getTextField(), SimpleDateFormat

getModel

public SpinnerDateModel getModel()

Return our spinner ancestor's SpinnerDateModel.

Returns:
getSpinner().getModel()
See Also:
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.