if (this.getParent() instanceof JPopupMenu) ((JPopupMenu) this.getParent()).setSelected(this);
if (parent != null && parent instanceof JPopupMenu) ((JPopupMenu) parent).setSelected(this);
  public void menuSelectionChanged(boolean changed)  {    if (changed)      {      model.setArmed(true);	if (this.getParent() instanceof JPopupMenu)	  ((JPopupMenu) this.getParent()).setSelected(this);      }    else      {      model.setArmed(false);	if (this.getParent() instanceof JPopupMenu)	  ((JPopupMenu) this.getParent()).getSelectionModel().clearSelection();      }  }