Sharing data between two JFrames and txt file
I have a program that is working that currently reads data from a .txt file, then saves to an arraylist which then that data is shown in a JListBox and also JTextFields. The user clicks a button to add new data entry and it currently uses JOptionPane to collect data. I want to change this. I have created a second form that opens when JButton clicked but I need help with communicating the data back to the arraylist/.txt file. I am wondering how should I make this work? Do I try to save data to the .txt file or the arraylist? The input fields are 2 string input and 3 integer which makes up one object. Also I do have a method to write the data to the Text File from JFrame1 but not the JFrame2(The one that opens when button clicked).