|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsource.ucregents.playground.gui.UserEvent
public class UserEvent
The UserEvent object stores all the components necessary to invoke any number of methods using reflection. This way you can dynamically add player events to an object to make them controllable by mouse and keyboard input.
Field Summary | |
---|---|
static int |
OBJECT_COLLIDED
|
static int |
OBJECT_DESTROYED
|
Constructor Summary | |
---|---|
UserEvent()
|
|
UserEvent(int e,
int es,
java.lang.reflect.Method meth,
java.lang.Object[] p,
java.lang.Object obj)
Constructor that accepts a single method and set of parameters rather than a vector of methods. |
|
UserEvent(int e,
int es,
java.lang.Object obj)
Simple constructor that accepts no methods or parameters. |
|
UserEvent(int e,
int es,
java.util.Vector<java.lang.reflect.Method> meth,
java.util.Vector<java.lang.Object[]> p,
java.lang.Object obj)
Main constructor. |
Method Summary | |
---|---|
void |
addMethod(java.lang.reflect.Method m)
|
void |
addMethodAndParams(java.lang.reflect.Method m,
java.lang.Object[] p)
Add a set of corresponding methods and parameters to the UserEvent vectors |
void |
addParams(java.lang.reflect.Method m)
|
UserEvent |
cloneTo(java.lang.Object obj)
Create a cloned version of this event to a given object |
void |
execute()
Attempt to invoke all methods with the given parameters. |
java.lang.String |
getActionCommand()
|
int |
getEventSubType()
|
int |
getEventType()
|
java.util.Vector<java.lang.reflect.Method> |
getMethods()
|
java.lang.Object |
getObject()
|
java.util.Vector<java.lang.Object[]> |
getParameters()
|
void |
removeMethod(int index)
|
void |
setActionCommand(java.lang.String s)
The set action command allows you to associate the user event with whatever text you like. |
void |
setEventSubType(int es)
|
void |
setEventType(int e)
|
void |
setMethod(java.util.Vector<java.lang.reflect.Method> meth)
|
void |
setObject(java.lang.Object obj)
|
void |
setParameters(java.util.Vector<java.lang.Object[]> p)
|
java.lang.String |
toString()
Associates this UserEvent with a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int OBJECT_COLLIDED
public static final int OBJECT_DESTROYED
Constructor Detail |
---|
public UserEvent()
public UserEvent(int e, int es, java.lang.reflect.Method meth, java.lang.Object[] p, java.lang.Object obj)
e
- event type which corresponds to the event ids (e.g.
MouseEvent.MOUSE_PRESSED)es
- event sub-type which corresponds to the exact event (e.g
MouseEvent.BUTTON1)meth
- Method to add to the method container for the objectp
- parameters that correspond to the given methodobj
- Object on which to invoke the given methodpublic UserEvent(int e, int es, java.lang.Object obj)
e
- event type which corresponds to the event ids (e.g.
MouseEvent.MOUSE_PRESSED)es
- event sub-type which corresponds to the exact event (e.g
MouseEvent.BUTTON1)obj
- Object on which to invoke the specified methodpublic UserEvent(int e, int es, java.util.Vector<java.lang.reflect.Method> meth, java.util.Vector<java.lang.Object[]> p, java.lang.Object obj)
e
- event type which corresponds to the event ids (e.g.
MouseEvent.MOUSE_PRESSED)es
- event sub-type which corresponds to the exact event (e.g
MouseEvent.BUTTON1)meth
- Vector of Methods to invoke on the given objectp
- Vector of parameters that correspond on a one-to-one basis
with the method vectorobj
- Object on which to invoke the given methodsMethod Detail |
---|
public void addMethod(java.lang.reflect.Method m)
public void addMethodAndParams(java.lang.reflect.Method m, java.lang.Object[] p)
m
- Method to addp
- Parameters to send to the methodpublic void addParams(java.lang.reflect.Method m)
public UserEvent cloneTo(java.lang.Object obj)
obj
-
public void execute()
public java.lang.String getActionCommand()
public int getEventSubType()
public int getEventType()
public java.util.Vector<java.lang.reflect.Method> getMethods()
public java.lang.Object getObject()
public java.util.Vector<java.lang.Object[]> getParameters()
public void removeMethod(int index)
public void setActionCommand(java.lang.String s)
s
- public void setEventSubType(int es)
public void setEventType(int e)
public void setMethod(java.util.Vector<java.lang.reflect.Method> meth)
public void setObject(java.lang.Object obj)
public void setParameters(java.util.Vector<java.lang.Object[]> p)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |