|
|
Receiving events from JavaThis page covers details of receiving Java events from C# and Visual Basic.Java InterfacesJava events are received on Java Interfaces. In order to receive events, you must add the necessary interfaces to the list of Java classes you wish to access. If you imported an entire Jar file, any interfaces within it should have automatically been added for you.Declaring and instantiating the interfaceTo receive events, an "Event Sink" class for the interface is created, by attaching the string _EventSink to the class name. For instance, if the interface is named "MyEvent", EZ JCom will also create an events sink class corresponding to it, named "MyEvent_EventSink".You would need to
Adding event handlersIn C# IDE's, if you type the name of the event sink object and enter a period (dot) character, Intellisense will show you the available interfaces. If you select an event name and then enter the += sequence, Intellisense will offer to complete the statement for you. Press TAB, and the code to add an event handler will be added. Press TAB again, and an event handler method will also be generated. You can also do this manually.In Visual Basic (VB.NET and earlier versions), in the "Code" view, the event sink object will be available for selection on the left side. When the event object has been selected on the left, on the right side you can select one of the handlers to implement, and the IDE will add the event handler framework. In VB.NET, instead of this approach you can also use AddHandler to add specific handlers, e.g.
AddHandler myEventSink.OnSomeEvent, AddressOf MyEventhandler
|