code: public void itemStateChanged(ItemEvent itemEvent) {
          try{
  
              // retrieve the control that the event has been invoked at...
              XCheckBox xCheckBox = (XCheckBox) UnoRuntime.queryInterface(XCheckBox.class, itemEvent.Source);
              
              if(xCheckBox != null) {
                  // retrieve the control that we want to disable or enable
                  XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, m_xDlgContainer.getControl("CommandButton1"));
                  XPropertySet xModelPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel());
                  short nState = xCheckBox.getState();
                  boolean bdoEnable = true;
                  switch (nState){
                      case 1:     // checked
                          bdoEnable = true;
                          break;
                      case 0:     // not checked
                      case 2:     // don't know
                          bdoEnable = false;
                          break;
                  }
                  // Alternatively we could have done it also this way:
                  // bdoEnable = (nState == 1);
                  xModelPropertySet.setPropertyValue("Enabled", new Boolean(bdoEnable));
              }
              
          }catch (com.sun.star.uno.Exception ex){
              /* perform individual exception handling here.
               * Possible exception types are:
               * com.sun.star.lang.IllegalArgumentException
               * com.sun.star.lang.WrappedTargetException,
               * com.sun.star.beans.UnknownPropertyException,
               * com.sun.star.beans.PropertyVetoException
               * com.sun.star.uno.Exception
               */
              ex.printStackTrace(System.out);
          }
      }
docs: /*## XItemListener ##