Java: Displaying all data in ArrayList in a table
<p>I am having some problems displaying data in an ArrayList in the form of a JTable.</p>

<p>The ArrayList consists of data, but only when the user enters data into JTextField's in a GUI (this GUI is in another class). I have used getText().</p>

<p>My ArrayList is in one class, but the GUI for the JFrame for the JTable is in another class. I can't seem to create a JTable in the GUI and I can't seem to be able to get the data from the ArrayList to be displayed in the JTable.</p>

<p>The ArrayList consists of 12 JTextFields all of which are Strings which should be the Headings for the JTable. When the program is launched, the user is able to enter their own data as many times as they want which is stored in the ArrayList under each Heading. This data is always different as the user enters different data all the time and therefore, I think, I cannot use this:</p>

<pre><code>String[] columnNames = {"First Name",
                    "Last Name",
                    "Sport",
                    "# of Years",
                    "Vegetarian"};

Object[][] data = {
    {"Kathy", "Smith",
     "Snowboarding", new Integer(5), new Boolean(false)},
    {"John", "Doe",
     "Rowing", new Integer(3), new Boolean(true)},
    {"Sue", "Black",
     "Knitting", new Integer(2), new Boolean(false)},
    {"Jane", "White",
     "Speed reading", new Integer(20), new Boolean(true)},
    {"Joe", "Brown",
     "Pool", new Integer(10), new Boolean(false)}
};
</code></pre>

<p>What do you think I should do? And how should I implement this?</p>

<p>Any help is much appreciated!</p>
