if (viewListener != null) getView().removeComponentListener(viewListener);
Component currView = getView(); if (viewListener != null && currView != null) currView.removeComponentListener(viewListener);
  public void setView(Component v)  {        if (viewListener != null)          getView().removeComponentListener(viewListener);    if (v != null)      {        if (viewListener == null)          viewListener = createViewListener();        v.addComponentListener(viewListener);    add(v);    fireStateChanged();  }    revalidate();    repaint();  }