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){
								
								}
}

Recommended Answers

All 2 Replies

I see. Didn't noticed that on the API documentation.

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.