01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: /**
18: * @author Michael Danilov
19: * @version $Revision$
20: */package java.awt.dnd;
21:
22: import java.awt.Point;
23: import java.util.EventObject;
24:
25: import org.apache.harmony.awt.internal.nls.Messages;
26:
27: public class DragSourceEvent extends EventObject {
28:
29: private static final long serialVersionUID = -763287114604032641L;
30: private final DragSourceContext context;
31: private final Point location;
32:
33: public DragSourceEvent(DragSourceContext dsc) {
34: super (dsc);
35:
36: context = dsc;
37: location = null;
38: }
39:
40: public DragSourceEvent(DragSourceContext dsc, int x, int y) {
41: super (dsc);
42:
43: if (dsc == null) {
44: // awt.18A=Context is null.
45: throw new IllegalArgumentException(Messages
46: .getString("awt.18A")); //$NON-NLS-1$
47: }
48:
49: context = dsc;
50: location = new Point(x, y);
51: }
52:
53: public DragSourceContext getDragSourceContext() {
54: return context;
55: }
56:
57: public Point getLocation() {
58: if (location != null) {
59: return new Point(location);
60: }
61:
62: return null;
63: }
64:
65: public int getY() {
66: if (location != null) {
67: return location.y;
68: }
69:
70: return 0;
71: }
72:
73: public int getX() {
74: if (location != null) {
75: return location.x;
76: }
77:
78: return 0;
79: }
80:
81: }
|