@Override
                public void actionPerformed(ActionEvent e) {
                    JTextField name = new JTextField();
                    JTextField server = new JTextField();
                    JTextField port = new JTextField();
                    JTextField password = new JTextField();
                    JTextField channels = new JTextField();
                    JCheckBox autoconnect = new JCheckBox();

                    Object[] fields = {
                            "Name", name,
                            "Server", server,
                            "Port", port,
                            "Password", password,
                            "Auto Join Channels (#c1 #c2)", channels,
                            "Connect on startup", autoconnect,
                    };
                    int x = JOptionPane.showConfirmDialog(dialog, fields, "Add Server", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
                    if (x == JOptionPane.CLOSED_OPTION || x == JOptionPane.CANCEL_OPTION) return;

                    String[] s = channels.getText().split(" ");
                    ArrayList<String> channelList = new ArrayList<>(Arrays.asList(s));
                    if (!StringUtils.isNumeric(port.getText())) {
                        JOptionPane.showMessageDialog(dialog, "Port must be an integer.");
                        return;
                    }
                    SavedConnection connection = new SavedConnection(name.getText(), server.getText(), password.getText(), channelList, autoconnect.isSelected(), Integer.valueOf(port.getText().trim()));
                    model.addRow(connection);
                    savedConnections.add(connection);
                    serializeSavedConnections();
                }