public CropImage2() {
        initComponents();

        fc = new JFileChooser();

        addB.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {

                int returnVal = fc.showOpenDialog(CropImage2.this);

                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    File file = fc.getSelectedFile();
                    try {
                        addImageToJPanel(file);
                    } catch (IOException ex) {
                        Logger.getLogger(CropImage2.class.getName()).log(Level.SEVERE, null, ex);
                    }
                } else {

                }

            }

        });
        saveB.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                
                String filename = JOptionPane.showInputDialog("Enter File Name.");
                if (filename == null) {
                    System.out.println("The user canceled");
                }else{
                    try {
                        createCropImage(c1, c2, w, h,filename);
                    } catch (AWTException ex) {
                        Logger.getLogger(CropImage2.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (IOException ex) {
                        Logger.getLogger(CropImage2.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }
        });
    }