For Programmers: Free Programming Magazines  


Home > Archive > Java Help > October 2006 > creating a repeating section









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author creating a repeating section
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

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com