0N/A/*
5779N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
0N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
2362N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2362N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0N/A * or visit www.oracle.com if you need additional information or have any
0N/A * questions.
0N/A */
0N/A
0N/Apackage com.apple.eawt.event;
0N/A
0N/Aimport javax.swing.*;
0N/A
0N/A/**
0N/A * Registration utility class to add {@link GestureListener}s to Swing components.
0N/A *
0N/A * This class manages the relationship between {@link JComponent}s and the {@link GestureListener}s
0N/A * attached to them. It's design is similar to the Java SE 6u10 {@link com.sun.awt.AWTUtilities}
0N/A * class which adds additional functionality to AWT Windows, without adding new API to the
0N/A * {@link java.awt.Window} class.
0N/A *
0N/A * To add a {@link GestureListener} to a top-level Swing window, use the {@link JRootPane} of the
0N/A * top-level window type.
0N/A *
0N/A * @see GestureAdapter
0N/A * @see JFrame#getRootPane()
0N/A * @see com.sun.awt.AWTUtilities
0N/A *
0N/A * @since Java for Mac OS X 10.5 Update 7, Java for Mac OS X 10.6 Update 2
0N/A */
0N/Apublic final class GestureUtilities {
0N/A GestureUtilities() {
0N/A // package private
4410N/A }
4410N/A
4410N/A /**
4410N/A * Attaches a {@link GestureListener} to the specified {@link JComponent}.
5779N/A * @param component to attach the {@link GestureListener} to
0N/A * @param listener to be notified when a gesture occurs
0N/A */
0N/A public static void addGestureListenerTo(final JComponent component, final GestureListener listener) {
2500N/A if (component == null || listener == null) throw new NullPointerException();
2500N/A GestureHandler.addGestureListenerTo(component, listener);
2500N/A }
2500N/A
2500N/A /**
2500N/A * Removes a {@link GestureListener} from the specified {@link JComponent}
* @param component to remove the {@link GestureListener} from
* @param listener to be removed
*/
public static void removeGestureListenerFrom(final JComponent component, final GestureListener listener) {
if (component == null || listener == null) throw new NullPointerException();
GestureHandler.removeGestureListenerFrom(component, listener);
}
}