Source Code Cross Referenced for DragSourceEvent.java in  » 6.0-JDK-Core » AWT » java » awt » dnd » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » AWT » java.awt.dnd 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1997-2003 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        package java.awt.dnd;
027
028        import java.awt.Point;
029
030        import java.util.EventObject;
031
032        /**
033         * This class is the base class for 
034         * <code>DragSourceDragEvent</code> and 
035         * <code>DragSourceDropEvent</code>.
036         * <p>
037         * <code>DragSourceEvent</code>s are generated whenever the drag enters, moves
038         * over, or exits a drop site, when the drop action changes, and when the drag
039         * ends. The location for the generated <code>DragSourceEvent</code> specifies
040         * the mouse cursor location in screen coordinates at the moment this event
041         * occured.
042         * <p>
043         * In a multi-screen environment without a virtual device, the cursor location is
044         * specified in the coordinate system of the <i>initiator</i>
045         * <code>GraphicsConfiguration</code>. The <i>initiator</i>
046         * <code>GraphicsConfiguration</code> is the <code>GraphicsConfiguration</code>
047         * of the <code>Component</code> on which the drag gesture for the current drag
048         * operation was recognized. If the cursor location is outside the bounds of
049         * the initiator <code>GraphicsConfiguration</code>, the reported coordinates are
050         * clipped to fit within the bounds of that <code>GraphicsConfiguration</code>.
051         * <p>
052         * In a multi-screen environment with a virtual device, the location is specified
053         * in the corresponding virtual coordinate system. If the cursor location is
054         * outside the bounds of the virtual device the reported coordinates are
055         * clipped to fit within the bounds of the virtual device.  
056         *
057         * @since 1.2
058         */
059
060        public class DragSourceEvent extends EventObject {
061
062            private static final long serialVersionUID = -763287114604032641L;
063
064            /**
065             * The <code>boolean</code> indicating whether the cursor location
066             * is specified for this event.
067             *
068             * @serial
069             */
070            private final boolean locationSpecified;
071
072            /**
073             * The horizontal coordinate for the cursor location at the moment this
074             * event occured if the cursor location is specified for this event; 
075             * otherwise zero. 
076             *
077             * @serial
078             */
079            private final int x;
080
081            /**
082             * The vertical coordinate for the cursor location at the moment this event
083             * occured if the cursor location is specified for this event; 
084             * otherwise zero. 
085             *
086             * @serial
087             */
088            private final int y;
089
090            /**
091             * Construct a <code>DragSourceEvent</code>
092             * given a specified <code>DragSourceContext</code>.
093             * The coordinates for this <code>DragSourceEvent</code>
094             * are not specified, so <code>getLocation</code> will return 
095             * <code>null</code> for this event.
096             * 
097             * @param dsc the <code>DragSourceContext</code>
098             *
099             * @throws <code>IllegalArgumentException</code> if <code>dsc</code> is <code>null</code>.
100             *
101             * @see #getLocation
102             */
103
104            public DragSourceEvent(DragSourceContext dsc) {
105                super (dsc);
106                locationSpecified = false;
107                this .x = 0;
108                this .y = 0;
109            }
110
111            /**
112             * Construct a <code>DragSourceEvent</code> given a specified
113             * <code>DragSourceContext</code>, and coordinates of the cursor
114             * location.
115             *
116             * @param dsc the <code>DragSourceContext</code>
117             * @param x   the horizontal coordinate for the cursor location
118             * @param y   the vertical coordinate for the cursor location
119             *
120             * @throws <code>IllegalArgumentException</code> if <code>dsc</code> is <code>null</code>.
121             *
122             * @since 1.4
123             */
124            public DragSourceEvent(DragSourceContext dsc, int x, int y) {
125                super (dsc);
126                locationSpecified = true;
127                this .x = x;
128                this .y = y;
129            }
130
131            /**
132             * This method returns the <code>DragSourceContext</code> that 
133             * originated the event.
134             * <P>
135             * @return the <code>DragSourceContext</code> that originated the event
136             */
137
138            public DragSourceContext getDragSourceContext() {
139                return (DragSourceContext) getSource();
140            }
141
142            /**
143             * This method returns a <code>Point</code> indicating the cursor
144             * location in screen coordinates at the moment this event occured, or
145             * <code>null</code> if the cursor location is not specified for this
146             * event. 
147             *
148             * @return the <code>Point</code> indicating the cursor location
149             *         or <code>null</code> if the cursor location is not specified
150             * @since 1.4
151             */
152            public Point getLocation() {
153                if (locationSpecified) {
154                    return new Point(x, y);
155                } else {
156                    return null;
157                }
158            }
159
160            /**
161             * This method returns the horizontal coordinate of the cursor location in
162             * screen coordinates at the moment this event occured, or zero if the
163             * cursor location is not specified for this event. 
164             *
165             * @return an integer indicating the horizontal coordinate of the cursor 
166             *         location or zero if the cursor location is not specified
167             * @since 1.4
168             */
169            public int getX() {
170                return x;
171            }
172
173            /**
174             * This method returns the vertical coordinate of the cursor location in
175             * screen coordinates at the moment this event occured, or zero if the
176             * cursor location is not specified for this event. 
177             *
178             * @return an integer indicating the vertical coordinate of the cursor
179             *         location or zero if the cursor location is not specified
180             * @since 1.4
181             */
182            public int getY() {
183                return y;
184            }
185        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.