code: private void setVisibilityOnControlledObject(Object controlledObject, boolean authorized) {
          try {
              Method method = controlledObject.getClass().getMethod( "setVisible", new Class[] { boolean.class } );
              method.invoke( controlledObject, new Object[] { new Boolean( authorized ) } );
          } catch( NoSuchMethodException ignored ) {
              System.out.println( "NO setVisible method on object: " + controlledObject );
              // No method to call, so nothing to do
          } catch( IllegalAccessException ignored ) {
              logger.error( "Could not call setVisible", ignored );
          } catch( InvocationTargetException ignored ) {
              logger.error( "Could not call setVisible", ignored );
          }
      }
docs: Set the visible property on a controlled action according to the provided
  authorization.