01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /**
19: * @author Anton Avtamonov
20: * @version $Revision$
21: */package javax.swing.event;
22:
23: import java.util.EventObject;
24:
25: public class ListSelectionEvent extends EventObject {
26: private final int firstIndex;
27: private final int lastIndex;
28: private final boolean isAdjusting;
29:
30: public ListSelectionEvent(final Object source,
31: final int firstIndex, final int lastIndex,
32: final boolean isAdjusting) {
33: super (source);
34: this .firstIndex = firstIndex;
35: this .lastIndex = lastIndex;
36: this .isAdjusting = isAdjusting;
37: }
38:
39: public int getFirstIndex() {
40: return firstIndex;
41: }
42:
43: public int getLastIndex() {
44: return lastIndex;
45: }
46:
47: public boolean getValueIsAdjusting() {
48: return isAdjusting;
49: }
50:
51: /*
52: * The format of the string is based on 1.5 release behavior
53: * which can be revealed using the following code:
54: *
55: * Object obj = new ListSelectionEvent(new JList(), 0, 1, false);
56: * System.out.println(obj.toString());
57: */
58: public String toString() {
59: return this .getClass().getName() + "[source=" + source
60: + " firstIndex= " + firstIndex + " lastIndex= "
61: + lastIndex + " isAdjusting= " + isAdjusting + " ]";
62: }
63: }
|