aby zachować dane okna dialogowego w java

if(e.getActionCommand().equals("save to file"))
    {
        System.out.println("save is pressed");
        StringBuffer fileContent = new StringBuffer();
        TableModel tModel = m_table.getModel();
        for (int i = 1; i < tModel.getRowCount(); i++) 
        {
         for(int j=0;j<tModel.getColumnCount();j++)
         {
            Object cellValue = tModel.getValueAt(i, j);
            // ... continue to read each cell in a row
            fileContent.append(cellValue);
            // ... continue to append each cell value
            fileContent.append(" ");
         }
         fileContent.append("\n");
        }
        FileWriter fileWriter;
        try {
            fileWriter = new FileWriter(new File("data.txt"));
            fileWriter.write(fileContent.toString());
            fileWriter.flush();
            fileWriter.close();
            }
        catch (IOException e1) 
        {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }

StworzyłemJDialog w którym znajduje się stół. Jestem w stanie zapisać dane tabeli w pliku za pomocą kliknięcia przycisku, ale chcę zachować te dane w tabeli, aby przy następnym uruchomieniu programu te dane były dostępne i wyświetlane w tabeli po naciśnięciu przycisku potwierdzenia. Chociaż przeczytałem o koncepcjach trwałości Java i serializacji Java, nie dostaję jasnego pomysłu, która technika jest odpowiednia i jak używać tego problemu.

questionAnswers(3)

yourAnswerToTheQuestion