public void addElement(PMElement e){
  if (e instanceof PMLabel) {
    labels.addArea(e);
  }
 else   if (e instanceof PMHotArea) {
    hotAreas.addArea(e);
    areascount++;
  }
 else   if (e instanceof PMAreasGroup) {
    PMAreasGroup ag=(PMAreasGroup)e;
    Enumeration<PMElement> iter=ag.elements();
    while (iter.hasMoreElements()) {
      addElement(iter.nextElement());
    }
  }
 else {
    otherAreas.addArea(e);
  }
}

public void addElement ( PMElement e ) { if ( e instanceof PMLabel ) { labels . addArea ( e ) ; } else if ( e instanceof PMHotArea ) { hotAreas . addArea ( e ) ; areascount ++ ; } else if ( e instanceof PMAreasGroup ) { PMAreasGroup ag = ( PMAreasGroup ) e ; Enumeration < PMElement > iter = ag . elements ( ) ; while ( iter . hasMoreElements ( ) ) { addElement ( iter . nextElement ( ) ) ; } } else { otherAreas . addArea ( e ) ; } }
adds element to picmap component . please note , that all objects implementing pmlabel interface will be placed in the topmost layer . all objects implementing pmhotarea will be placed in the middle layer . all others are going to bottom layer . within same layer objects are drawing by order they added to components .
