public void componentHidden(ComponentEvent e){
  Layer layer=getLayer();
  if (layer != null) {
    if (e.getComponent() == layer) {
      if (getState() != false && menuType == LAYERS_ON_OFF) {
        setState(false);
        if (Debug.debugging("layersmenu")) {
          Debug.output("layersmenu.LCBMI: layer " + layer.getName() + " is now hidden.");
        }
      }
    }
 else     if (e.getComponent() == layer.getPalette() && menuType == PALETTES_ON_OFF) {
      setState(false);
    }
  }
}

public void componentHidden ( ComponentEvent e ) { Layer layer = getLayer ( ) ; if ( layer != null ) { if ( e . getComponent ( ) == layer ) { if ( getState ( ) != false && menuType == LAYERS_ON_OFF ) { setState ( false ) ; if ( Debug . debugging ( "layersmenu" ) ) { Debug . output ( "layersmenu.LCBMI: layer " + layer . getName ( ) + " is now hidden." ) ; } } } else if ( e . getComponent ( ) == layer . getPalette ( ) && menuType == PALETTES_ON_OFF ) { setState ( false ) ; } } }
this menu item listens to the status of its layer . if the layer becomes invisible , it disables the check box .
