Xoetrope

 Wiki : EventsConcept

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

The Event Concept


Events occur when a user interacts with the UI by way of the mouse or keyboard, for example when the user clicks on a button and Action event is triggered. Mostly, applications just need to know that an event has occured. In response to an event the application provides some action, implemented as an event handler of some sort. In XUI the event handler is just a plain old Java method.

In XML the event handler is specified as follows:

  1. <XPage class="my.package.MyClass" ...>
  2.    <Components>
  3.      ...
  4.      <Button name="myButton" .../>
  5.    </Components>
  6.    <Events>
  7.       <Event method="myHandler" target="myButton" type="ActionHandler"/>
  8.       ...
  9.    </Events>
  10.    ...
  11.  </XPage>

where my myHandler is a method implemented in MyClass.java as follows:

  1. package my.package;
  2.  
  3. import net.xoetrope.xui.*;
  4. import net.xoetrope.swing.*;
  5.  
  6. public class MyClass
  7. {
  8.    .../
  9.   public void myHandler()
  10.   {
  11.     // Insert you application specific code here...
  12.   }
  13. }


More reading:
  1. Advanced event handling

SourceForge Logo

CategoryConcepts

There are no comments on this page. [Add comment]

Page was generated in 0.1459 seconds