KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > ChartMouseEvent


1 /* ===========================================================
2  * JFreeChart : a free chart library for the Java(tm) platform
3  * ===========================================================
4  *
5  * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
6  *
7  * Project Info: http://www.jfree.org/jfreechart/index.html
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this library; if not, write to the Free Software Foundation,
21  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
24  * in the United States and other countries.]
25  *
26  * --------------------
27  * ChartMouseEvent.java
28  * --------------------
29  * (C) Copyright 2002-2005, by Object Refinery Limited and Contributors.
30  *
31  * Original Author: David Gilbert (for Object Refinery Limited);
32  * Contributor(s): Alex Weber;
33  *
34  * $Id: ChartMouseEvent.java,v 1.3 2005/05/19 15:40:56 mungady Exp $
35  *
36  * Changes
37  * -------
38  * 27-May-2002 : Version 1, incorporating code and ideas by Alex Weber (DG);
39  * 13-Jun-2002 : Added Javadoc comments (DG);
40  * 26-Sep-2002 : Fixed errors reported by Checkstyle (DG);
41  * 05-Nov-2002 : Added a reference to the source chart (DG);
42  * 13-Jul-2004 : Now extends EventObject and implements Serializable (DG);
43  *
44  */

45
46 package org.jfree.chart;
47
48 import java.awt.event.MouseEvent JavaDoc;
49 import java.io.Serializable JavaDoc;
50 import java.util.EventObject JavaDoc;
51
52 import org.jfree.chart.entity.ChartEntity;
53
54 /**
55  * A mouse event for a chart that is displayed in a {@link ChartPanel}.
56  */

57 public class ChartMouseEvent extends EventObject JavaDoc implements Serializable JavaDoc {
58
59     /** For serialization. */
60     private static final long serialVersionUID = -682393837314562149L;
61     
62     /** The chart that the mouse event relates to. */
63     private JFreeChart chart;
64
65     /** The Java mouse event that triggered this event. */
66     private MouseEvent JavaDoc trigger;
67
68     /** The chart entity (if any). */
69     private ChartEntity entity;
70
71     /**
72      * Constructs a new event.
73      *
74      * @param chart the source chart (<code>null</code> not permitted).
75      * @param trigger the mouse event that triggered this event
76      * (<code>null</code> not permitted).
77      * @param entity the chart entity (if any) under the mouse point
78      * (<code>null</code> permitted).
79      */

80     public ChartMouseEvent(JFreeChart chart, MouseEvent JavaDoc trigger,
81                            ChartEntity entity) {
82         super(chart);
83         this.chart = chart;
84         this.trigger = trigger;
85         this.entity = entity;
86     }
87
88     /**
89      * Returns the chart that the mouse event relates to.
90      *
91      * @return The chart (never <code>null</code>).
92      */

93     public JFreeChart getChart() {
94         return this.chart;
95     }
96
97     /**
98      * Returns the mouse event that triggered this event.
99      *
100      * @return The event (never <code>null</code>).
101      */

102     public MouseEvent JavaDoc getTrigger() {
103         return this.trigger;
104     }
105
106     /**
107      * Returns the chart entity (if any) under the mouse point.
108      *
109      * @return The chart entity (possibly <code>null</code>).
110      */

111     public ChartEntity getEntity() {
112         return this.entity;
113     }
114
115 }
116
Popular Tags