blob: e5677b77951168c2adfc39386379aa6bd70595b4 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * 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
26package javax.swing.event;
27
28import java.util.EventObject;
29import 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 * @author Alan Chung
46 * @see TableColumnModelListener
47 */
48public class TableColumnModelEvent extends java.util.EventObject
49{
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, int to) {
76 super(source);
77 fromIndex = from;
78 toIndex = to;
79 }
80
81//
82// Querying Methods
83//
84
85 /** Returns the fromIndex. Valid for removed or moved events */
86 public int getFromIndex() { return fromIndex; };
87
88 /** Returns the toIndex. Valid for add and moved events */
89 public int getToIndex() { return toIndex; };
90}