    public SudokuSolverClass() {
        setContentPane(contentPane);
        setModal(true);
        getRootPane().setDefaultButton(selFileBut);
        buttonOK.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                onOK();
            }
        });
        buttonCancel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                onCancel();
            }
        });
        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                onCancel();
            }
        });
        contentPane.registerKeyboardAction(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                onCancel();
            }
        }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
        this.setResizable(false);
        selFileBut.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                JFileChooser fc = new JFileChooser();
                fc.setFileFilter(new FileFilter() {
                    @Override
                    public boolean accept(File file) {
                        if (file.isDirectory()) return true;
                        String[] filenameParts = file.getName().split("\\.");
                        return filenameParts[filenameParts.length - 1].toLowerCase().equals("sud");
                    }
                    @Override
                    public String getDescription() {
                        return "Sudoku files";
                    }
                });
                if (fc.showDialog(selFileBut, "") == JFileChooser.APPROVE_OPTION) {
                    textField1.setText(fc.getSelectedFile().getAbsolutePath());
                    try{
                        fillField();
                    } catch (Exception e) {
                        JOptionPane.showMessageDialog(getRootPane(), "Somewhat went wrong", "Error", JOptionPane.ERROR_MESSAGE);
                    }
                    sudokuSolutionShow();
                    getRootPane().setDefaultButton(buttonOK);
                }
            }
        });
    }

    public SudokuSolverClass() {
        setContentPane(contentPane);
        setModal(true);
        getRootPane().setDefaultButton(selFileBut);
        buttonOK.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                onOK();
            }
        });
        buttonCancel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                onCancel();
            }
        });
        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                onCancel();
            }
        });
        contentPane.registerKeyboardAction(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                onCancel();
            }
        }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
        this.setResizable(false);
        selFileBut.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                JFileChooser fc = new JFileChooser();
                fc.setFileFilter(new FileFilter() {
                    @Override
                    public boolean accept(File file) {
                        if (file.isDirectory()) return true;
                        String[] filenameParts = file.getName().split("\\.");
                        return filenameParts[filenameParts.length - 1].toLowerCase().equals("sud");
                    }
                    @Override
                    public String getDescription() {
                        return "Sudoku files";
                    }
                });
                if (fc.showDialog(selFileBut, "") == JFileChooser.APPROVE_OPTION) {
                    textField1.setText(fc.getSelectedFile().getAbsolutePath());
                    try{
                        fillField();
                    } catch (Exception e) {
                        JOptionPane.showMessageDialog(getRootPane(), "Something went wrong", "Error", JOptionPane.ERROR_MESSAGE);
                    }
                    sudokuSolutionShow();
                    getRootPane().setDefaultButton(buttonOK);
                }
            }
        });
    }
