/** Updates the user message based on the current state of the application. */
  private void updateMessages() {
    browseStatusPanel.setBrowseStatus(browseStatus);

    if (!lifeCycleComplete) {
      messageLabel.setText(
          I18n.tr("LimeWire will start your search right after it finishes loading."));
      messagePanel.setVisible(true);
      browseFailedPanel.setVisible(false);
    } else if (!fullyConnected) {
      messageLabel.setText(
          I18n.tr("You might not receive many results until LimeWire finishes loading..."));
      messagePanel.setVisible(true);
      browseFailedPanel.setVisible(false);
    } else if (browseStatus != null && !browseStatus.getState().isOK()) {
      browseFailedPanel.update(
          browseStatus.getState(), browseStatus.getBrowseSearch(), browseStatus.getFailedFriends());
      browseFailedPanel.setVisible(true);
    } else {
      messagePanel.setVisible(false);
      browseFailedPanel.setVisible(false);
    }

    filterPanel.setVisible(!browseFailedPanel.isVisible());
    scrollPane.setVisible(!browseFailedPanel.isVisible());
  }
 /**
  * Disposes of resources used by the container. This method is called when the search is closed.
  */
 @Override
 public void dispose() {
   SwingUiSettings.SEARCH_VIEW_TYPE_ID.removeSettingListener(viewTypeListener);
   searchResultsModel.getFilteredList().removeListEventListener(resultCountListener);
   searchResultsModel.getUnfilteredList().removeListEventListener(resultCountListener);
   sortAndFilterPanel.dispose();
   filterPanel.dispose();
   classicSearchReminderPanel.dispose();
   browseFailedPanel.dispose();
   searchResultsModel.dispose();
   browseStatusPanel.dispose();
 }