@Override
                public void actionPerformed(ActionEvent e) {
                    int rowIndex = table.getSelectedRow();
                    if (rowIndex == -1) return;
                    int modelIndex = table.convertRowIndexToModel(rowIndex);
                    SavedConnection conn = model.modelData.get(modelIndex);

                    JTextField ename = new JTextField(conn.retrieveName());
                    JTextField eserver = new JTextField(conn.retrieveServer());
                    JTextField eport = new JTextField(Integer.toString(conn.retrievePort()));
                    JTextField epassword = new JTextField(conn.retrievePassword());
                    String c = conn.retrieveChannels().toString();
                    JTextField echannels = new JTextField(c.substring(1, c.length() - 1));
                    JCheckBox eautoconnect = new JCheckBox();
                    if (conn.retrieveAutoConnect()) eautoconnect.setSelected(true);
                    else eautoconnect.setSelected(false);

                    Object[] efields = {
                            "Name", ename,
                            "Server", eserver,
                            "Port", eport,
                            "Password", epassword,
                            "Auto Join Channels (#c1 #c2)", echannels,
                            "Connect on startup", eautoconnect,
                    };
                    int ex = JOptionPane.showConfirmDialog(dialog, efields, "Edit Server", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
                    if (ex == JOptionPane.CLOSED_OPTION || ex == JOptionPane.CANCEL_OPTION) return;

                    String[] es = echannels.getText().replace(",", "").split(" ");
                    ArrayList<String> echannelList = new ArrayList<>(Arrays.asList(es));
                    if (!StringUtils.isNumeric(eport.getText())) {
                        JOptionPane.showMessageDialog(dialog, "Port must be an integer.");
                        return;
                    }
                    model.removeRowRange(modelIndex, modelIndex);
                    savedConnections.remove(conn);
                    SavedConnection connection = new SavedConnection(ename.getText(), eserver.getText(), epassword.getText(), echannelList, eautoconnect.isSelected(), Integer.valueOf(eport.getText().trim()));
                    model.addRow(connection);
                    savedConnections.add(connection);
                    serializeSavedConnections();
                }