code: public void actionPerformed(ActionEvent rEvent) {
          try{
              // get the control that has fired the event,
              XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, rEvent.Source);
              XControlModel xControlModel = xControl.getModel();
              XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
              String sName = (String) xPSet.getPropertyValue("Name");
              // just in case the listener has been added to several controls,
              // we make sure we refer to the right one
              if (sName.equals("CommandButton1")) {
                  //...
              }
          }catch (com.sun.star.uno.Exception ex){
              /* perform individual exception handling here.
               * Possible exception types are:
               * com.sun.star.lang.WrappedTargetException,
               * com.sun.star.beans.UnknownPropertyException,
               * com.sun.star.uno.Exception
               */
              ex.printStackTrace(System.out);
          }
      }
docs: /*## XActionListener ##