@Action
    public void openfile() {int c =0;
JPasswordField pf = new JPasswordField();
JOptionPane.showConfirmDialog(null, pf, "Enter Password(max 6 char)", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
String pass = new String(pf.getPassword());
try
		{
                    BufferedReader br = new BufferedReader(new FileReader("C:/securednotes/config.config"));
			String sCurrentLine;

			while ((sCurrentLine = br.readLine()) != null) {
                             BigInteger bigInt = new BigInteger(sCurrentLine);
                                String textBack = new String(bigInt.toByteArray());
                            if(textBack.equals(pass)){ c=1;}
                        else{
                        JOptionPane.showMessageDialog(null, "Wrong Password", "Secure Note", JOptionPane.INFORMATION_MESSAGE);
                        System.exit(0);
                        }

			}
                
		} catch (IOException e) {
		}
if(c==1){jFileChooser2 = new JFileChooser("C:/securednotes");
jFileChooser2.setFileSelectionMode(JFileChooser.FILES_ONLY);
 FileNameExtensionFilter xmlfilter = new FileNameExtensionFilter(".txt files (*.txt)", "txt");
           jFileChooser2.setFileFilter(xmlfilter);

         jFileChooser2.setFileFilter(xmlfilter);

int returnVal = jFileChooser2.showOpenDialog(this.getFrame());

if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = jFileChooser2.getSelectedFile();
        // ... code that loads the contents of the file in the text area
       BufferedReader br = null;


		try {
			String sCurrentLine;

			br = new BufferedReader(new FileReader(file));

			while ((sCurrentLine = br.readLine()) != null) {
//				System.out.println(sCurrentLine);//converting the string in file to big int and converting back.
                                BigInteger bigInt = new BigInteger(sCurrentLine);
                                String textBack = new String(bigInt.toByteArray());
//System.out.println(textBack);

                                jTextArea1.setText(textBack);
                                jTextArea2.setText(file.getName().replace(".txt",""));
                        }

		} catch (IOException e) {
		} finally {
			try {
				if (br != null)br.close();
			} catch (IOException ex) {
			}


                }
    } else {
        // ...
    }
}

    }