1 /*
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
109 * of all JavaBeans™
110 * has been added to the <code>java.beans</code> package.
111 * Please see {@link java.beans.XMLEncoder}.
112 *
113 * @beaninfo
114 * attribute: isContainer false
115 * description: A single line input field that lets the user select a
116 * number or an object value from an ordered set.
117 *
118 * @see SpinnerModel
119 * @see AbstractSpinnerModel
120 * @see SpinnerListModel
121 * @see SpinnerNumberModel
122 * @see SpinnerDateModel
123 * @see JFormattedTextField
124 *
125 * @author Hans Muller
126 * @author Lynn Monsanto (accessibility)
127 * @since 1.4
128 */
129 public class JSpinner extends JComponent implements Accessible
130 {
131 /**
132 * @see #getUIClassID
133 * @see #readObject
134 */
135 private static final String uiClassID = "SpinnerUI";
136
137 private static final Action DISABLED_ACTION = new DisabledAction();
138
139 private SpinnerModel model;
140 private JComponent editor;
141 private ChangeListener modelListener;
142 private transient ChangeEvent changeEvent;
143 private boolean editorExplicitlySet = false;
144
145
146 /**
147 * Constructs a spinner for the given model. The spinner has
148 * a set of previous/next buttons, and an editor appropriate
|
1 /*
2 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
109 * of all JavaBeans™
110 * has been added to the <code>java.beans</code> package.
111 * Please see {@link java.beans.XMLEncoder}.
112 *
113 * @beaninfo
114 * attribute: isContainer false
115 * description: A single line input field that lets the user select a
116 * number or an object value from an ordered set.
117 *
118 * @see SpinnerModel
119 * @see AbstractSpinnerModel
120 * @see SpinnerListModel
121 * @see SpinnerNumberModel
122 * @see SpinnerDateModel
123 * @see JFormattedTextField
124 *
125 * @author Hans Muller
126 * @author Lynn Monsanto (accessibility)
127 * @since 1.4
128 */
129 @SuppressWarnings("serial") // Same-version serialization only
130 public class JSpinner extends JComponent implements Accessible
131 {
132 /**
133 * @see #getUIClassID
134 * @see #readObject
135 */
136 private static final String uiClassID = "SpinnerUI";
137
138 private static final Action DISABLED_ACTION = new DisabledAction();
139
140 private SpinnerModel model;
141 private JComponent editor;
142 private ChangeListener modelListener;
143 private transient ChangeEvent changeEvent;
144 private boolean editorExplicitlySet = false;
145
146
147 /**
148 * Constructs a spinner for the given model. The spinner has
149 * a set of previous/next buttons, and an editor appropriate
|