The output is obtained from a JPasswordField and placed into a text. But whenever I enter a new input on the field, it just shows the recent one I've entered...

Ex: I enter "test1" as a password. When I enter a new one, say "test2", it only shows "test2" in the text file.

confirm.addActionListener(new ActionListener(){
	public void actionPerformed(ActionEvent e){
									
								
	try{
		FileOutputStream outFileStream = new FileOutputStream("ouput.txt");
		PrintWriter outStream = new PrintWriter(outFileStream);								
									
									
		char[] pass = passwordField.getPassword();
		char[] cpw = confirmPasswordField.getPassword();
									
							outStream.append(String.copyValueOf(pass));
									outStream.append(",");
									outStream.append(String.copyValueOf(cpw));
		outStream.println();
		outStream.close();
									
								}catch(Exception ex){
								
								}
}

Edited 5 Years Ago by CodeAerial: n/a

This question has already been answered. Start a new discussion instead.