protected void addOkAndCancel() {
        //Layout the buttons in a panel
        JPanel okAndCancelPane = new JPanel(new FlowLayout());

        JButton cancelButton = new JButton("Cancel");
        cancelButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                close();
            }
        });
        okAndCancelPane.add(cancelButton);

        JButton okButton = new JButton("Ok");
        okButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (isValidInput()) {
                    update();
                    close();
                }
            }
        });
        okButton.setEnabled(true);
        okAndCancelPane.add(okButton);

        add(okAndCancelPane, BorderLayout.SOUTH);
    }