public void checkForActiveTab() {


        if (!this.connection.isConnected) {
            for (int i = 0; i < GUI.getTabbedPane().getTabCount(); i++) {
                ChannelPanel channel = (ChannelPanel)GUI.getTabbedPane().getComponentAt(i);
                if (channel.connection == this.connection) {
                    if (!channel.enableNotifications || GUI.disableTabNotificationsGlobally) break;
                    else {
                                GUI.getTabbedPane().setIconAt(i, GUI.notConnectedIcon);
                    }
                }
            }
            return;
        }

        if (!this.isShowing() && !GUI.disableTabNotificationsGlobally && enableNotifications) {
            for (int i = 0; i < GUI.getTabbedPane().getTabCount(); i++) {
                ChannelPanel channel = (ChannelPanel) GUI.getTabbedPane().getComponentAt(i);

                if (channel.title.equals(this.title)) {
                    GUI.getTabbedPane().setIconAt(i, GUI.newMessageIcon);
                    break; //a PM only goes to one window so we can stop looking
                }
            }

        } else {
            ChannelPanel channel = (ChannelPanel) GUI.getTabbedPane().getSelectedComponent();
            if (channel == null) return;
            final int index = Connection.findTab(channel.title, connection);
            if (index == -1) return;
            else GUI.getTabbedPane().setIconAt(index, null);

        }
    }