Path: blob/master/test/jdk/javax/swing/JSpinner/6463712/bug6463712.java
41153 views
/*1* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import javax.swing.JSpinner;24import javax.swing.SpinnerDateModel;25import javax.swing.SpinnerNumberModel;26import javax.swing.event.ChangeEvent;27import javax.swing.event.ChangeListener;2829/*30* @test31* @bug 646371232* @summary Events forwarded from previous model33*/34public class bug6463712 implements ChangeListener {3536public bug6463712() {37SpinnerNumberModel m1 = new SpinnerNumberModel();38JSpinner s = new JSpinner(m1);39s.addChangeListener(this);40SpinnerDateModel m2 = new SpinnerDateModel();41s.setModel(m2);4243// m1 is no longer linked to the JSpinner (it has been replaced by m2), so44// the following should not trigger a call to our stateChanged() method...45m1.setValue(new Integer(1));46}4748public void stateChanged(ChangeEvent e) {49throw new RuntimeException("Should not receive this event.");50}5152public static void main(String[] args) {53bug6463712 bug = new bug6463712();54}55}565758