1 /*
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. 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. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * 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™
42 * has been added to the {@code java.beans} package.
43 * Please see {@link java.beans.XMLEncoder}.
44 *
45 * @author Alan Chung
46 * @see TableColumnModelListener
47 */
48 @SuppressWarnings("serial") // Same-version serialization only
49 public class TableColumnModelEvent extends java.util.EventObject
50 {
51 //
52 // Instance Variables
53 //
54
55 /** The index of the column from where it was moved or removed */
56 protected int fromIndex;
57
58 /** The index of the column to where it was moved or added */
59 protected int toIndex;
60
61 //
62 // Constructors
63 //
64
65 /**
66 * Constructs a {@code TableColumnModelEvent} object.
67 *
68 * @param source the {@code TableColumnModel} that originated the event
69 * @param from an int specifying the index from where the column was
70 * moved or removed
71 * @param to an int specifying the index to where the column was
72 * moved or added
73 * @see #getFromIndex
74 * @see #getToIndex
75 */
76 public TableColumnModelEvent(TableColumnModel source, int from, int to) {
77 super(source);
78 fromIndex = from;
79 toIndex = to;
80 }
81
82 //
83 // Querying Methods
84 //
85
86 /**
87 * Returns the fromIndex. Valid for removed or moved events
88 *
89 * @return int value for index from which the column was moved or removed
90 */
91 public int getFromIndex() { return fromIndex; };
92
93 /**
94 * Returns the toIndex. Valid for add and moved events
95 *
96 * @return int value of column's new index
97 */
98 public int getToIndex() { return toIndex; };
99 }
--- EOF ---