public void onNick(IRCUserInfo user, String nickNew) {
    String nick = user.getNick();
    if (nickNew.equals(conn.getNick()))
      mainFrame.setNick(nickNew);
    String line = "* Nick: "+ nick +" is now known as "+ nickNew;
    int tabsAmount = mainFrame.getTabCount();
    for (int i = 0; i < tabsAmount; i++) {
      Component component = mainFrame.getComponentAt(i);
      if (component instanceof ChanPanel) {
        String status = mainFrame.removeNick(i, nick); 
        if (status != null) { 
          mainFrame.addNick(i, status + nickNew);
          mainFrame.updateTab(i, line);
        }
      } else if (component instanceof QueryPanel && 
                 mainFrame.getTitleAt(i).equals(nick)) {
        mainFrame.setTitleAt(i, nickNew); 
        ((PanelTemplate)component).setWindowName(nickNew); 
        mainFrame.setSelectedTab(); 
      }
    }
  }