| Justin 2006-10-30, 7:33 pm |
| I am creating a GUI that interacts with a database. Part of this
interaction is that the user will be able to pull data from the
database. I would like the user to be able to pull multiple records
from the database and display them in a cascading manner. I built a
class that extends a JPanel which contains several JTextBoxes and
JComboBoxes to display the stored data. I plan on writing SQL code
within this class to submit to the database.
This class is instantiated in another class that extends the
JDialogBox, and is specifically inserted into a JScrollPane within the
extended JDialogBox class.
What I have in the JDialogBox is a For-Loop that cycles through and
creates the desired number of the extended JPanels. That code is as
follows:
RepeatingTableElement table = new RepeatingTableElement();
tableHolder.add(table);
table.setName("test" + counter++);
table.setSize(630,200);
tableHolder.revalidate();
scroller.revalidate();
where "table" is the extended JPanel class I made, "tableHolder" is a
JPanel, and "scroller" is a JScrollPane.
My question: I want to insert a button to submit the data to the
database. Is the code I have now sufficient to call the method in each
instance of the RepeatingTableElement? If not, what do I change to be
able to call a submit method? And finally, how would I call the submit
method for each instance?
Thanks
|