java.util

Class EventObject

Implemented Interfaces:
Serializable
Known Direct Subclasses:
ApplicationEvent, AWTEvent, BeanContextEvent, CaretEvent, ChangeEvent, ChartChangeEvent, ChartMouseEvent, ChartProgressEvent, CheckStateChangedEvent, ColumnViewerEditorActivationEvent, ColumnViewerEditorDeactivationEvent, ConfigurationEvent, ConnectionEvent, ConnectionEvent, CopyStreamEvent, DataModelEvent, DatasetChangeEvent, DoubleClickEvent, DragGestureEvent, DragSourceEvent, DropTargetEvent, ELContextEvent, ElementEvent, EventObject, FacesEvent, FlavorEvent, HttpSessionEvent, HyperlinkEvent, LabelProviderChangedEvent, LineEvent, ListDataEvent, ListSelectionEvent, LocaleChangeEvent, MenuEvent, NamingEvent, NamingExceptionEvent, NodeChangeEvent, Notification, OpenEvent, PageChangedEvent, PageChangingEvent, PhaseEvent, PopupMenuEvent, PreferenceChangeEvent, PrintEvent, ProgressEvent, PropertyChangeEvent, PropertyChangeEvent, ProtocolCommandEvent, RoundCompleteEvent, RowSetEvent, SelectionChangedEvent, SeriesChangeEvent, ServletContextEvent, ServletRequestEvent, SWTEventObject, TableColumnModelEvent, TableModelEvent, TreeExpansionEvent, TreeExpansionEvent, TreeModelEvent, TreeSelectionEvent, UndoableEditEvent, UnsolicitedNotificationEvent, WorkEvent

public class EventObject
extends Object
implements Serializable

The root class from which all event state objects shall be derived.

All Events are constructed with a reference to the object, the "source", that is logically deemed to be the object upon which the Event in question initially occurred upon.

Since:
JDK1.1
See Also:
Serialized Form

Field Summary

protected Object
source
The object on which the Event initially occurred.

Constructor Summary

EventObject(Object source)
Constructs a prototypical Event.

Method Summary

Object
getSource()
The object on which the Event initially occurred.
String
toString()
Returns a String representation of this EventObject.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

source

protected Object source
The object on which the Event initially occurred.

Constructor Details

EventObject

public EventObject(Object source)
Constructs a prototypical Event.
Parameters:
source - The object on which the Event initially occurred.
Throws:
IllegalArgumentException - if source is null.
Usages and Demos :

View More Examples of EventObject(Object source)
   1:         addListener (new TestEventListener ("E"));
   2:         fireEvent(new java.util.EventObject(this));
   3:     }
   4: }

View Full Code Here
   1:         Object o = new Object();
   2:         EventObject ev = new EventObject(o);
   3:         EventObject ev2 = new EventObject(new Object());
   4:         ...
   5:         DerivedEvent wrong_source = new DerivedEvent(new Object());
   6:         EventObject wrong_type = new EventObject(o);
   7:         EventObject wrong_source_and_type = new EventObject(new Object());
   8: 
   9:         IsEventFrom p = new IsEventFrom(DerivedEvent.class, o);

View Full Code Here
   1:                {
   2:                   java.util.EventObject eventObject = new java.util.EventObject("");
   3:                   DistributedEventManager.getInstance().publishEvent(eventObject, lookup);
   4:                }
   5:                c = System.in.read();

View Full Code Here
   1:                 DemoButtonListener listener = (DemoButtonListener) listeners.get(i);
   2:                 listener.buttonPressed(new EventObject(this));
   3:             }
   4:         ...
   5:                     DemoButtonListener listener = (DemoButtonListener) listeners.get(i);
   6:                     listener.buttonPressed(new EventObject(this));
   7:                 }
   8:                 break;
   9:             }

View Full Code Here

Method Details

getSource

public Object getSource()
The object on which the Event initially occurred.
Returns:
The object on which the Event initially occurred.
Usages and Demos :

View More Examples of getSource()
   1: 
   2: import java.util.EventObject;
   3: import org.jmock.core.Constraint;
   4:         ...
   5:     public IsEventFrom( Object source ) {
   6:         this(EventObject.class, source);
   7:     }
   8:         ...
   9:     public boolean eval( Object o ) {
  10:         return (o instanceof EventObject)
  11:             && eventClass.isInstance(o) 
  12:         ...
  13:     private boolean eventHasSameSource(EventObject ev) {
  14:         return ev.getSource() == source;

View Full Code Here
   1:   }
   2:   public boolean isCellEditable(EventObject e) {
   3:     return true;
   4:         ...
   5:   }
   6:   public boolean shouldSelectCell(EventObject e) {
   7:     return true;
   8:   }
   9:   public boolean stopCellEditing() {

View Full Code Here
   1: import javax.swing.table.*;
   2: import java.util.EventObject;
   3: import javax.swing.event.ChangeEvent;
   4:         ...
   5: 
   6:       public boolean shouldSelectCell(EventObject e)
   7:       {
   8:         ...
   9:          JTable table = (JTable)e.getSource();

View Full Code Here
   1: import javax.swing.table.*;
   2: import java.util.EventObject;
   3: import javax.swing.event.ChangeEvent;
   4:         ...
   5: 
   6:       public boolean shouldSelectCell(EventObject e)
   7:       {
   8:         ...
   9:          JTable table = (JTable)e.getSource();

View Full Code Here
   1: 
   2: import java.util.EventObject;
   3: import java.util.Iterator;
   4:         ...
   5: 
   6:     public void parentAnnotationChanged(EventObject e) {
   7:         ...
   8:         if (e.getSource() instanceof Annotation) {
   9:         ...
  10:             if (((Annotation) e.getSource()).isMarkedDeleted()) {

View Full Code Here

toString

public String toString()
Returns a String representation of this EventObject.
Overrides:
toString in interface Object
Returns:
A a String representation of this EventObject.
Usages and Demos :

View More Examples of toString()
   1: 
   2: import java.util.EventObject;
   3: 
   4:         ...
   5:   private long millis;
   6:   private EventObject event;
   7: 
   8:         ...
   9:  public MyEventWrapper (EventObject eo) {
  10:     millis = System.currentTimeMillis();
  11:         ...
  12:   public String toString () {
  13:     return event.toString() + " " + Long.toString (millis);

View Full Code Here