KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > swt > internal > SWTEventObject


1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.swt.internal;
12
13  
14 /**
15  * This class is the cross-platform version of the
16  * java.util.EventObject class.
17  * <p>
18  * It is part of our effort to provide support for both J2SE
19  * and J2ME platforms. Under this scheme, classes need to
20  * extend SWTEventObject instead of java.util.EventObject.
21  * </p>
22  * <p>
23  * Note: java.util.EventObject is not part of CDC and CLDC.
24  * </p>
25  */

26 public class SWTEventObject implements SerializableCompatibility {
27     
28     /**
29      * The event source.
30      */

31     protected transient Object JavaDoc source;
32
33 /**
34  * Constructs a new instance of this class.
35  *
36  * @param source the object which fired the event
37  */

38 public SWTEventObject(Object JavaDoc source) {
39     if (source != null) this.source = source;
40     else throw new IllegalArgumentException JavaDoc();
41 }
42
43 /**
44  * Answers the event source.
45  *
46  * @return the object which fired the event
47  */

48 public Object JavaDoc getSource() {
49     return source;
50 }
51
52 /**
53  * Answers the string representation of this SWTEventObject.
54  *
55  * @return the string representation of this SWTEventObject
56  */

57 public String JavaDoc toString() {
58     return getClass().getName() + "[source=" + String.valueOf(source) + ']';
59 }
60
61 }
62
Popular Tags