My text is getting replaced when i press the button to add text - it's also supposed to be shown in a table, but it just replaces
private void SavebtnActionPerformed(java.awt.event.ActionEvent evt) {
String Id = clientId.getText();
String Name = ClientName.getText();
String Author = AuthorName.getText();
String Categories = jComboBox1.getSelectedItem().toString();
String Quantity = Clientquan.getText();
String Price = bookprice.getText();
java.io.PrintWriter output=null;
java.io.File file=new java.io.File("BookStore.txt");
// if (file.exists()) {
// JOptionPane.showMessageDialog(rootPane, "The file already exists!");
// System.exit(0);
// }
try{
output=new java.io.PrintWriter("BookStore.txt");
output.write( Id+ " , " + Name + " , "+Author+ " , " + Categories+ " , " +Quantity+ " , "+Price );
JOptionPane.showMessageDialog(rootPane, "Text is saved successfully");
}
catch(java.io.IOException ex){
JOptionPane.showMessageDialog(rootPane, "Operation is not successful!");
}
finally {
if ( output!=null) output.close();
}