4 Replies Latest reply on May 6, 2014 2:19 PM by gimbal2

    How to use Event Listeners in java?


      hi could anyone explain me about how the event Listeners work in java,To get the data based on the event occurs in outside the application.

      I have this method in one of my API class I am not understanding how this methods are going to work.


      public interface SBXPCXMLEventListener {
      public void OnReceiveEventXML(String eventXML);
      private static List<SBXPCXMLEventListener> listenerList = new ArrayList<SBXPCXMLEventListener>();

      protected static void fireXMLEvent(String xml) {
      Iterator<SBXPCXMLEventListener> iter = listenerList.iterator();
      while (iter.hasNext()) {

      public static void addXMLListener(SBXPCXMLEventListener listener) {

      public static Object removeXMLListener(SBXPCXMLEventListener listener) {
      return listenerList.remove(listener);

      i have done like this.This is used to capture the events from the fingerprint machine when run this class I am not getting any data from the machine when i did thumb impression in the machine.

      public class EventListnere implements SBXPCXMLEventListener {


          public static void main(String[] args) {

              boolean flag = SBXPCProxy.ConnectTcpip(1, "", 5005, 1234);

              System.out.println("flag = " + flag);

      //        SBXPCProxy.st

      //        System.out.println("before "+System.currentTimeMillis());

              boolean flag1 = SBXPCProxy.StartEventCapture(1, 1, 1);

              EventListnere el = new EventListnere();





          public void OnReceiveEventXML(String eventXML) {

              System.out.println("eventXML = " + eventXML);