public void file_open()
    {
        JFileChooser fc = new JFileChooser();
        fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
        int r=fc.showOpenDialog(this);
        if(r==fc.CANCEL_OPTION)
            return;
        File myfile = fc.getSelectedFile();
        if(myfile == null || myfile.getName().equals(""))
        {
            
            JOptionPane.showMessageDialog(this, "Select a file!", "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }
        String file_ext= myfile.getName();
        CharSequence png = "png";
        CharSequence txt = "txt";
        CharSequence img_tester = "@@$$~";
        try
        {
        if(file_ext.contains(png))
        {

            int x=myfile.getName().length();
            String path_temp= myfile.getAbsolutePath().replace(myfile.getName(),"");
            String temp = stg_obj.decode(path_temp,myfile.getName().replace(".png",""));
            if(temp.contains(img_tester))
            {
                t.setText(temp.toString().replace(img_tester,""));
                content = t.getText();
                path = myfile.toString();
                setTitle(myfile.getName()+" - SecureNote");
            }
            else
            {
                //If a image is not encrypted , i.e., when a user opens invalid image
            JOptionPane.showMessageDialog(null, "Invalid Image opened  "); 
            }
        }
        else
        {
                BufferedReader input = new BufferedReader(new FileReader(myfile));
                StringBuffer str = new StringBuffer();
                String line;
                while((line = input.readLine()) != null)
                    str.append(line+"\n");
                t.setText(crypter(str.toString()));
                setTitle(myfile.getName() + "- SecureNote");
        }
        }
        catch(Exception e)
        {
            JOptionPane.showMessageDialog(null, "File not found: "); //changed here!!!

        }

    }