/*********************Pay Button Listener***************************************/
public class payListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
String fileName2 = "Ticket/"+ticketIDNumber+".dat";
File ticket2 = new File(fileName2);
if(ticket2.exists()){
try{
FileReader fileReader = new FileReader(fileName2);
BufferedReader bufferedReader = new BufferedReader(fileReader);
bufferedReader.readLine(); //OMIT Entrance Time
FileWriter fw = new FileWriter(fileName2);
BufferedWriter bufferedWriter = new BufferedWriter(fw);
//fw.write("Hello");
bufferedReader.close();
fileReader.close();
fw.close();
}
catch(IOException f){
System.out.println("Error in Setting Payment Time for ticket");
}
}
}
}
/*********************Pay Button Listener***************************************/
Someone please show me how to replace content in file, only the 2nd line please. current file looks like this:
1324254875443
1313131
Paid
0.0