Common Problems

With every dialog you need the same things...

A standard content area with standard margins and standard buttons in a standard layout with the buttons at the bottom right and matching sizes and spaced just so...








       ...and the same actions...

okButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent event) {
        if (dataIsValid()) {
            setModelFromView();
            setVisible(false);
        }
cancelButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent event) {
        setVisible(false);
    }
});