frame.dispose();
                    public void actionPerformed(ActionEvent e) {                        //if (frame == null) {                            frame = new JFrame("Desktop color");                            colorChooser = new JColorChooser();                            frame.add(colorChooser, BorderLayout.CENTER);                            JButton ok = new JButton("OK");                            ok.addActionListener(new ActionListener() {                                public void actionPerformed(ActionEvent event) {                                    desktop.setBackground(colorChooser.getColor());                                    frame.setVisible(false);                                }                            });                            JButton apply = new JButton("Apply");                            apply.addActionListener(new ActionListener() {                                public void actionPerformed(ActionEvent event) {                                    desktop.setBackground(colorChooser.getColor());                                }                            });                            JButton cancel = new JButton("Cancel");                            cancel.addActionListener(new ActionListener() {                                public void actionPerformed(ActionEvent event) {                                    desktop.setBackground(oldColor);                                    frame.setVisible(false);                                }                            });                            JPanel buttons = new JPanel();                            buttons.add(ok);                            buttons.add(apply);                            buttons.add(cancel);                            frame.add(buttons, BorderLayout.SOUTH);                        //}                        oldColor = desktop.getBackground();                        colorChooser.setColor(oldColor);                        Dimension ss = Toolkit.getDefaultToolkit().getScreenSize();                        int x = (ss.width - 500) / 2;                        int y = (ss.height - 400) / 2;                        frame.setSize(500, 400);                        frame.setVisible(true);                        frame.setLocation(x, y);                    }