private void makePanel() throws BadLocationException, IOException {
        userListPane.setModel(model);
        userListPane.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        userListPane.setLayoutOrientation(JList.VERTICAL);
        userListPane.setCellRenderer(new CustomRenderer());
        userListPane.setAutoscrolls(false);
        userListPane.setFocusable(false);
        userListPane.setMaximumSize(new Dimension(25, 25));


        JPopupMenu ULpopup = new JPopupMenu();
        JMenuItem ULpopOpenQuery = new JMenuItem("Open Query", GUI.popupQueryIcon);
        JMenuItem ULpopWhois = new JMenuItem("Whois", GUI.popupWhoisIcon);
        JMenuItem ULpopVersion = new JMenuItem("Version", GUI.popupVersionIcon);
        JMenuItem ULpopPing = new JMenuItem("Ping", GUI.popupPingIcon);
        JMenuItem ULpopIgnore = new JMenuItem("Ignore", GUI.popupIgnoreIcon);
        ULpopup.add(ULpopOpenQuery);
        ULpopup.addSeparator();
        ULpopup.add(ULpopWhois);
        ULpopup.add(ULpopVersion);
        ULpopup.add(ULpopPing);
        ULpopup.addSeparator();
        ULpopup.add(ULpopIgnore);
        userListPane.setComponentPopupMenu(ULpopup);
        ULpopOpenQuery.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                User nick = userListPane.getSelectedValue();
                if (nick == null) return;
                String nickname = nick.getText();
                if (nickname.equals(Connection.currentNick)) return;
                try {
                    ChannelPanel channel = new ChannelPanel(nickname, nickname, ChannelPanel.this.connection);
                    channel.setRightComponent(null);
                    channel.setDividerSize(0);
                    GUI.getTabbedPane().setSelectedComponent(channel);

                } catch (BadLocationException | IOException ex) {
                    Logger.getLogger(ChannelPanel.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
        ULpopWhois.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                User nick = userListPane.getSelectedValue();
                if (nick == null) return;
                String nickname = nick.getText();
                if (nickname.equals(Connection.currentNick)) return;
                try {
                    ChannelPanel.this.connection.send("WHOIS " + nickname);
                } catch (IOException | BadLocationException ex) {
                    Logger.getLogger(ChannelPanel.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
        ULpopVersion.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                User nick = userListPane.getSelectedValue();
                if (nick == null) return;
                String nickname = nick.getText();
                if (nickname.equals(Connection.currentNick)) return;
                try {
                    ChannelPanel.this.connection.send("PRIVMSG " + nickname + " \001VERSION");
                } catch (IOException | BadLocationException ex) {
                    Logger.getLogger(ChannelPanel.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
        ULpopPing.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                Long longTime = System.currentTimeMillis() / 1000L;
                User nick = userListPane.getSelectedValue();
                if (nick == null) return;
                String nickname = nick.getText();
                if (nickname.equals(Connection.currentNick)) return;
                try {
                    ChannelPanel.this.connection.send("PRIVMSG " + nickname + " :\001PING " + longTime + "\001");
                } catch (IOException | BadLocationException ex) {
                    Logger.getLogger(ChannelPanel.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
        ULpopIgnore.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                User nick = userListPane.getSelectedValue();
                if (nick == null) return;
                String nickname = nick.getText();
                if (nickname.equals(Connection.currentNick)) return;
                if (ignoreList.contains(nick.getText())) {
                    ignoreList.remove(nick.getText());
                    String[] msg = {null, "*** "+ nickname +" removed from ignore list."};
                    try {
                        insertString(msg, GUI.serverStyle, false);
                    } catch (BadLocationException | IOException ex) {
                        Logger.getLogger(ChannelPanel.class.getName()).log(Level.SEVERE, null, ex);
                    }
                } else {
                    ignoreList.add(nick.getText());
                    String[] msg = {null, "*** " + nickname + " added to ignore list."};
                    try {
                        insertString(msg, GUI.serverStyle, false);
                    } catch (BadLocationException | IOException ex) {
                        Logger.getLogger(ChannelPanel.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }
        });

        JPopupMenu CPpopup = new JPopupMenu();
        final JMenuItem CPCopy = new JMenuItem("Copy", GUI.copyIcon);
        JMenuItem CPFind = new JMenuItem("Find", GUI.findTextIcon);
        JMenuItem CPSelectAll = new JMenuItem("Select All", GUI.selectAllIcon);
        CPpopup.add(CPCopy);
        CPpopup.add(CPFind);
        CPpopup.add(CPSelectAll);
        chatPane.setComponentPopupMenu(CPpopup);
        CPCopy.addActionListener(new DefaultEditorKit.CopyAction());
        CPFind.addActionListener(GUI.FindTextAction.getInstance());
        CPSelectAll.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                        chatPane.selectAll();
            }
        });
        CPpopup.addPopupMenuListener(new PopupMenuListener() {
            @Override
            public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
                if (chatPane.getSelectedText() == null) CPCopy.setForeground(Color.gray);
                    // if (chatPane.getSelectedText().isEmpty()) CPCopy.setForeground(Color.gray);
                else CPCopy.setForeground(Color.black);
            }

            @Override
            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            }

            @Override
            public void popupMenuCanceled(PopupMenuEvent e) {
            }
        });

        JPopupMenu CIPpopup = new JPopupMenu();
        final JMenuItem CIPCut = new JMenuItem("Cut", GUI.cutIcon);
        final JMenuItem CIPCopy = new JMenuItem("Copy", GUI.copyIcon);
        final JMenuItem CIPPaste = new JMenuItem("Paste", GUI.pasteIcon);
        final JMenuItem CIPClear = new JMenuItem("Clear", GUI.clearTextIcon);
        final JMenuItem CIPSelectAll = new JMenuItem("Select All", GUI.selectAllIcon);
        CIPpopup.add(CIPCut);
        CIPpopup.add(CIPCopy);
        CIPpopup.add(CIPPaste);
        CIPpopup.addSeparator();
        CIPpopup.add(CIPClear);
        CIPpopup.add(CIPSelectAll);
        GUI.getChatInputPane().setComponentPopupMenu(CIPpopup);

        CIPCopy.addActionListener(new DefaultEditorKit.CopyAction());
        CIPCut.addActionListener(new DefaultEditorKit.CutAction());
        CIPPaste.addActionListener(new DefaultEditorKit.PasteAction());
        CIPClear.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                GUI.getChatInputPane().setText(null);
            }
        });
        CIPSelectAll.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                GUI.getChatInputPane().selectAll();
            }
        });
        CIPpopup.addPopupMenuListener(new PopupMenuListener() {
            @Override
            public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
                if (GUI.getChatInputPane().getText().isEmpty()) {
                    CIPCut.setForeground(Color.gray);
                    CIPPaste.setForeground(Color.black);
                    CIPCopy.setForeground(Color.gray);
                    CIPSelectAll.setForeground(Color.gray);
                    CIPClear.setForeground(Color.gray);
                } else {
                    CIPCut.setForeground(Color.black);
                    CIPPaste.setForeground(Color.black);
                    CIPCopy.setForeground(Color.black);
                    CIPSelectAll.setForeground(Color.black);
                    CIPClear.setForeground(Color.black);
                }
            }

            @Override
            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            }

            @Override
            public void popupMenuCanceled(PopupMenuEvent e) {
            }
        });

        setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));


        setResizeWeight(1.0);
        setDividerSize(5);
        setVerifyInputWhenFocusTarget(false);

        chatPane.setEditable(false);
        chatPane.setAutoscrolls(true);
        userListScrollPane.setViewportView(userListPane);
        chatScrollPane.setViewportView(chatPane);
        chatScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

        chatPane.setEditorKit(new WrapEditorKit());

        setLeftComponent(chatScrollPane);
        if (name.startsWith("#")) {
            setRightComponent(userListScrollPane);

            setDividerLocation(GUI.getFrame().getWidth() - 160);


            //setDividerLocation(dividerLocation);
        } else {
            setRightComponent(null);
            setDividerSize(0);
        }

        addPropertyChangeListener(new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent e) {
                JSplitPane sourcePane = (JSplitPane) e.getSource();
                if (e.getPropertyName().equals(JSplitPane.LAST_DIVIDER_LOCATION_PROPERTY)) {
                    dividerLocation = GUI.getFrame().getWidth() - sourcePane.getDividerLocation();

                }
            }
        });
        addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                setDividerLocation(GUI.getFrame().getWidth() - dividerLocation);
            }
        });

    }