01: /*
02: * Copyright (C) 2004 NNL Technology AB
03: * Visit www.infonode.net for information about InfoNode(R)
04: * products and how to contact NNL Technology AB.
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License
08: * as published by the Free Software Foundation; either version 2
09: * of the License, or (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19: * MA 02111-1307, USA.
20: */
21:
22: // $Id: TabDragEvent.java,v 1.13 2005/02/16 11:28:15 jesper Exp $
23: package net.infonode.tabbedpanel;
24:
25: import java.awt.*;
26: import java.awt.event.MouseEvent;
27:
28: /**
29: * TabDragEvent is an mouseEvent that contains information about the tab that is
30: * beeing dragged from a tabbed panel and a point specifying the mouse
31: * coordinates.
32: *
33: * @author $Author: jesper $
34: * @version $Revision: 1.13 $
35: * @see TabbedPanel
36: * @see Tab
37: */
38: public class TabDragEvent extends TabEvent {
39: private MouseEvent mouseEvent;
40:
41: /**
42: * Constructs a TabDragEvent
43: *
44: * @param source the Tab or TabbedPanel that is the source for this
45: * mouseEvent
46: * @param tab the Tab that is being dragged
47: * @param point the mouse coordinates relative to the Tab that is being
48: * dragged
49: * @deprecated Use {@link #TabDragEvent(Object, java.awt.event.MouseEvent)} instead.
50: */
51: public TabDragEvent(Object source, Tab tab, Point point) {
52: this (source, new MouseEvent(tab, MouseEvent.MOUSE_DRAGGED,
53: System.currentTimeMillis(), 0, point.x, point.y, 0,
54: false));
55: }
56:
57: /**
58: * Constructs a TabDragEvent
59: *
60: * @param source the Tab or TabbedPanel that is the source for this
61: * @param mouseEvent the mouse mouseEvent that triggered the drag, the event source should be the tab and the event
62: * point should be relative to the tab
63: * @since ITP 1.3.0
64: */
65: public TabDragEvent(Object source, MouseEvent mouseEvent) {
66: super (source, (Tab) mouseEvent.getSource());
67: this .mouseEvent = mouseEvent;
68: }
69:
70: /**
71: * Gets the mouse coordinates
72: *
73: * @return the mouse coordinats relative to the Tab that is beeing
74: * dragged
75: */
76: public Point getPoint() {
77: return mouseEvent.getPoint();
78: }
79:
80: /**
81: * Returns the mouse event that triggered this drag. The event source is set to the tab and the event point is
82: * relative to the tab.
83: *
84: * @return the mouse event that triggered this drag
85: * @since ITP 1.3.0
86: */
87: public MouseEvent getMouseEvent() {
88: return mouseEvent;
89: }
90:
91: }
|