public void buildSettingsWindow(){
        getCurrentSettings();
        final JFrame settingsFrame = new JFrame("Settings");
        JPanel settingsPanel = new JPanel();
        ButtonGroup buttonGroup = new ButtonGroup();

        rndCheck = new JRadioButton("Set random order");
        allWordsCheck = new JRadioButton("Set all words");
        trainCheck = new JRadioButton("User's set");
        switch (mySets.getKindOfTrain()) {
            case 1:
                rndCheck.setSelected(true);
                break;
            case 2:
                allWordsCheck.setSelected(true);
                break;
            case 3:
                trainCheck.setSelected(true);
                break;
            default:
                System.out.println("Apparently something happened in SW");
        }
        JLabel numberWordsLabel = new JLabel("Number of words:");
        numberWordsLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
        textNumberWords = new JTextField(25);
        textNumberWords.setText(String.valueOf(mySets.getNumberOfGuessableWords()));
        textNumberWords.setMaximumSize(textNumberWords.getPreferredSize());
        JLabel daysLeftLabel = new JLabel("For left days:");
        daysLeftLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
        textLeftDays = new JTextField(25);
        textLeftDays.setText(String.valueOf(mySets.getLeftDays()));
        textLeftDays.setMaximumSize(textLeftDays.getPreferredSize());
        errLabel = new JLabel("");
        buttonGroup.add(rndCheck);
        buttonGroup.add(allWordsCheck);
        buttonGroup.add(trainCheck);
        settingsPanel.add(rndCheck);
        settingsPanel.add(allWordsCheck);
        settingsPanel.add(trainCheck);
        settingsPanel.add(numberWordsLabel);
        settingsPanel.add(textNumberWords);
        settingsPanel.add(daysLeftLabel);
        settingsPanel.add(textLeftDays);
        settingsPanel.add(errLabel);
        settingsPanel.setLayout(new BoxLayout(settingsPanel, BoxLayout.Y_AXIS));
        settingsPanel.setBorder(BorderFactory.createEmptyBorder(5,5,10,0));

        JButton okBtn = new JButton("OK");
        JButton cancelBtn = new JButton("Cancel");
        JPanel btnPanel = new JPanel();
        btnPanel.add(cancelBtn);
        btnPanel.add(okBtn);

        settingsFrame.getContentPane().add(BorderLayout.CENTER, settingsPanel);
        settingsFrame.getContentPane().add(BorderLayout.SOUTH, btnPanel);
        settingsFrame.setSize(180, 200);
        settingsFrame.setVisible(true);



        rndCheck.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                if (rndCheck.isSelected()){
                    textNumberWords.setEnabled(false);
                    textLeftDays.setEnabled(false);
                    mySettings.setKindOfTrain(1);
                } else {
                    textNumberWords.setEnabled(true);
                    textLeftDays.setEnabled(true);
                }
            }
        });

        allWordsCheck.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                if(allWordsCheck.isSelected()) {
                    textNumberWords.setEnabled(false);
                    textLeftDays.setEnabled(false);
                    mySettings.setKindOfTrain(2);
                } else {
                    textNumberWords.setEnabled(true);
                    textLeftDays.setEnabled(true);
                }

            }
        });

        trainCheck.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                mySettings.setKindOfTrain(3);
            }
        });


        cancelBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                settingsFrame.dispose();
            }
        });
        okBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    mySettings.setNumberOfGuessableWords(Integer.parseInt(textNumberWords.getText()));
                    FileOutputStream fileOutputStream= new FileOutputStream("settings.txt");
                    ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
                    objectOutputStream.writeObject(mySettings);
                    objectOutputStream.close();
                    System.out.println("SW| Собрался");
                    System.out.println("SW| cntOfWords: " + mySettings.getNumberOfGuessableWords());
                    settingsFrame.dispose();
                } catch (NumberFormatException ex) {
                    errLabel.setText("Please, write a number!");
                } catch (FileNotFoundException e1) {
                    e1.printStackTrace();
                } catch (IOException e1) {
                    e1.printStackTrace();
                }

            }
        });
    }