I suppose to write the records to a text file. However every time i re-log in and add a record.The previous record will be rewrite. >.<''

public void addRecords(){
		getInfo();
		FileWriter fWriter = null;
		BufferedWriter writer = null;
		try {
			fWriter = new FileWriter("PassengerInfo.txt");
			writer = new BufferedWriter(fWriter);
			writer.write(name);
			writer.write(";");
			writer.write(phone);
			writer.write(";");
			writer.write(nationality);
			writer.write(";");
			writer.write(IC);
			writer.newLine();
			
			writer.close();
		}catch (IOException e) {
			JOptionPane.showMessageDialog(null,"FILE NOT EXIST");
		}
	}

Are there any way to keep the record?

I think when you instantiate your instance of FileWriter you need to do so in appendable mode. to do that, you write as follows:
new FileWriter(PassengerInfo.txt", true);

let me know if that works.

Yup, it works!
Thanks you so much!

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.