01 /*
02 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package javax.swing.event;
27
28 import java.util.EventObject;
29 import javax.swing.table.*;
30
31 /**
32 * <B>TableColumnModelEvent</B> is used to notify listeners that a table
33 * column model has changed, such as a column was added, removed, or
34 * moved.
35 * <p>
36 * <strong>Warning:</strong>
37 * Serialized objects of this class will not be compatible with
38 * future Swing releases. The current serialization support is
39 * appropriate for short term storage or RMI between applications running
40 * the same version of Swing. As of 1.4, support for long term storage
41 * of all JavaBeans<sup><font size="-2">TM</font></sup>
42 * has been added to the <code>java.beans</code> package.
43 * Please see {@link java.beans.XMLEncoder}.
44 *
45 * @version 1.25 05/05/07
46 * @author Alan Chung
47 * @see TableColumnModelListener
48 */
49 public class TableColumnModelEvent extends java.util.EventObject {
50 //
51 // Instance Variables
52 //
53
54 /** The index of the column from where it was moved or removed */
55 protected int fromIndex;
56
57 /** The index of the column to where it was moved or added */
58 protected int toIndex;
59
60 //
61 // Constructors
62 //
63
64 /**
65 * Constructs a {@code TableColumnModelEvent} object.
66 *
67 * @param source the {@code TableColumnModel} that originated the event
68 * @param from an int specifying the index from where the column was
69 * moved or removed
70 * @param to an int specifying the index to where the column was
71 * moved or added
72 * @see #getFromIndex
73 * @see #getToIndex
74 */
75 public TableColumnModelEvent(TableColumnModel source, int from,
76 int to) {
77 super (source);
78 fromIndex = from;
79 toIndex = to;
80 }
81
82 //
83 // Querying Methods
84 //
85
86 /** Returns the fromIndex. Valid for removed or moved events */
87 public int getFromIndex() {
88 return fromIndex;
89 };
90
91 /** Returns the toIndex. Valid for add and moved events */
92 public int getToIndex() {
93 return toIndex;
94 };
95 }
|