private void init(JDialog frame) {

        //initialize properties file
        try {
            if(new File(this.propertiesPath).isFile()) {
                prop.load(new FileInputStream(this.propertiesPath));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        //set size of the window
        frame.setSize(d);
        frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        frame.setResizable(false);

        JPanel settingsPane = new JPanel();
        GridLayout layout = new GridLayout(6,1);
        settingsPane.setLayout(layout);
        frame.getContentPane().add(settingsPane);

        JPanel lp = new JPanel(new FlowLayout(FlowLayout.LEFT));
        lp.add(databasePathLabel);
        settingsPane.add(lp);
        databasePathField.setText(prop.getProperty("database_path", ""));
        JPanel rp = new JPanel(new FlowLayout(FlowLayout.LEFT));
        rp.add(databasePathField);
        settingsPane.add(rp);

        JPanel ldn = new JPanel(new FlowLayout(FlowLayout.LEFT));
        ldn.add(databaseNameLabel);
        settingsPane.add(ldn);
        databaseNameField.setText(prop.getProperty("database_name", ""));
        JPanel rdn = new JPanel(new FlowLayout(FlowLayout.LEFT));
        rdn.add(databaseNameField);
        settingsPane.add(rdn);

        JPanel lu = new JPanel(new FlowLayout(FlowLayout.LEFT));
        lu.add(databaseUserLabel);
        settingsPane.add(lu);
        databaseUserField.setText(prop.getProperty("database_user", ""));
        JPanel ru = new JPanel(new FlowLayout(FlowLayout.LEFT));
        ru.add(databaseUserField);
        settingsPane.add(ru);

        JPanel lpl = new JPanel(new FlowLayout(FlowLayout.LEFT));
        lpl.add(databasePasswordLabel);
        settingsPane.add(lpl);
        databasePasswordField.setText(prop.getProperty("database_password", ""));
        JPanel rpl = new JPanel(new FlowLayout(FlowLayout.LEFT));
        rpl.add(databasePasswordField);
        settingsPane.add(rpl);

        JPanel lcl = new JPanel(new FlowLayout(FlowLayout.LEFT));
        lcl.add(autoConnectLabel);
        settingsPane.add(lcl);
        if(prop.getProperty("auto_connection", "false").equals("true")){
            autoConnectField.setSelected(true);
        }
        JPanel rcl = new JPanel(new FlowLayout(FlowLayout.LEFT));
        rcl.add(autoConnectField);
        settingsPane.add(rcl);

        JPanel lb = new JPanel(new FlowLayout());
        lb.add(saveButton);
        settingsPane.add(lb);

        JPanel rb = new JPanel(new FlowLayout());
        rb.add(cancelButton);
        settingsPane.add(rb);

        saveButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    prop.setProperty("database_path", databasePathField.getText());
                    prop.setProperty("database_name", databaseNameField.getText());
                    prop.setProperty("database_user", databaseUserField.getText());
                    System.out.println(databasePasswordField.getPassword().toString());
                    prop.setProperty("database_password", new String(databasePasswordField.getPassword()));
                    if(autoConnectField.isSelected()){
                        prop.setProperty("auto_connection", "true");
                    } else {
                        prop.setProperty("auto_connection", "false");
                    }
                    prop.store(new FileOutputStream(propertiesPath), null);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }

                JOptionPane.showMessageDialog(SettingsWindow.this, "Настройки успешно сохранены");
                SettingsWindow.this.setVisible(false);
                SettingsWindow.this.dispose();
            }
        });

        cancelButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                SettingsWindow.this.setVisible(false);
                SettingsWindow.this.dispose();
            }
        });

    }