1 /* 2 * Copyright (c) 1999, 2011, 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 23 * questions. 24 */ 25 package javax.swing; 26 27 /** 28 * A <code>ComponentInputMap</code> is an <code>InputMap</code> 29 * associated with a particular <code>JComponent</code>. 30 * The component is automatically notified whenever 31 * the <code>ComponentInputMap</code> changes. 32 * <code>ComponentInputMap</code>s are used for 33 * <code>WHEN_IN_FOCUSED_WINDOW</code> bindings. 34 * 35 * @author Scott Violet 36 * @since 1.3 37 */ 38 @SuppressWarnings("serial") 39 public class ComponentInputMap extends InputMap { 40 /** Component binding is created for. */ 41 private JComponent component; 42 43 /** 44 * Creates a <code>ComponentInputMap</code> associated with the 45 * specified component. 46 * 47 * @param component a non-null <code>JComponent</code> 48 * @throws IllegalArgumentException if <code>component</code> is null 49 */ 50 public ComponentInputMap(JComponent component) { 51 this.component = component; 52 if (component == null) { 53 throw new IllegalArgumentException("ComponentInputMaps must be associated with a non-null JComponent"); 54 } 55 } 56 57 /** 58 * Sets the parent, which must be a <code>ComponentInputMap</code> | 1 /* 2 * Copyright (c) 1999, 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 23 * questions. 24 */ 25 package javax.swing; 26 27 /** 28 * A <code>ComponentInputMap</code> is an <code>InputMap</code> 29 * associated with a particular <code>JComponent</code>. 30 * The component is automatically notified whenever 31 * the <code>ComponentInputMap</code> changes. 32 * <code>ComponentInputMap</code>s are used for 33 * <code>WHEN_IN_FOCUSED_WINDOW</code> bindings. 34 * 35 * @author Scott Violet 36 * @since 1.3 37 */ 38 @SuppressWarnings("serial") // Field data not serializable across versions 39 public class ComponentInputMap extends InputMap { 40 /** Component binding is created for. */ 41 private JComponent component; 42 43 /** 44 * Creates a <code>ComponentInputMap</code> associated with the 45 * specified component. 46 * 47 * @param component a non-null <code>JComponent</code> 48 * @throws IllegalArgumentException if <code>component</code> is null 49 */ 50 public ComponentInputMap(JComponent component) { 51 this.component = component; 52 if (component == null) { 53 throw new IllegalArgumentException("ComponentInputMaps must be associated with a non-null JComponent"); 54 } 55 } 56 57 /** 58 * Sets the parent, which must be a <code>ComponentInputMap</code> |