private SettingsDialog()
    {
        super();

        setResizable(false);
        setSize(350, 200);

        contentPane.setBorder(DefaultUIProvider.getDefaultEmptyEtchedEmptyBorder());

        setContentPane(contentPane);
        setModal(true);
        getRootPane().setDefaultButton(buttonOK);

        buttonOK.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                onOK();
            }
        });

        buttonCancel.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                onCancel();
            }
        });

// call onCancel() when cross is clicked
        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
        addWindowListener(new WindowAdapter()
        {
            public void windowClosing(WindowEvent e)
            {
                onCancel();
            }
        });

// call onCancel() on ESCAPE
        contentPane.registerKeyboardAction(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                onCancel();
            }
        }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

        dataSourceCombo.addActionListener(new ActionListener()
        {
            @Override
            public void actionPerformed(ActionEvent e)
            {
                boolean advancedSettingsVisible = dataSourceCombo.getSelectedIndex() == 1;

                advancedMySQLSettings.setVisible(advancedSettingsVisible);
                SettingsDialog.this.pack();
            }
        });

        testConnectionButton.addActionListener(new ActionListener()
        {
            @Override
            public void actionPerformed(ActionEvent e)
            {
                MessageDialog messageDialog = MessageDialog.getInstance();

                try
                {
                    if (getMySQLQuestionsStrategy().getStatement() != null)
                        messageDialog.show("Всё работает!");
                }
                catch (SQLException e1)
                {
                    handleError("Cannot connect to database!", e1);
                }
            }
        });

        ImageIcon aboutIcon = new ImageIcon(getClass().getResource("/img/about.png"));
        aboutButton.setIcon(aboutIcon);

        aboutButton.addActionListener(new ActionListener()
        {
            @Override
            public void actionPerformed(ActionEvent e)
            {
                new AboutDialog().showDialog();
            }
        });

        loadPreferences();
    }