craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > General QuickTable Support/Help Post New Topic   Post A Reply
Appending rows to table printer friendly version
next newest post | next oldest post
Author Messages
spamhurts
Private

Gender: Unspecified
Location:
Registered: Jul 2007
Status: Offline
Posts: 3

Click here to see the profile for spamhurts Send email to spamhurts Find more posts by spamhurts Edit or delete this message Reply w/Quote
Posted Sunday, July 15, 2007 @ 08:16:19  

I'm trying to create a scrolling datawindow that displays events as they are inserted into a database table. Is there a way I can append rows to the end of a table after the table has been populated? Do I need to maintain my own table model to do this? If so, are there any examples on how this is done?
Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Monday, July 16, 2007 @ 11:27:45  

With quicktable you don't need to write table model. To give an answer, I need to better understand your requirements.

Does the database table gets updated with new events by processes outside your swing application or the events itself are added to the database through quicktable?

spamhurts
Private

Gender: Unspecified
Location:
Registered: Jul 2007
Status: Offline
Posts: 3

Click here to see the profile for spamhurts Send email to spamhurts Find more posts by spamhurts Edit or delete this message Reply w/Quote
Posted Monday, July 16, 2007 @ 14:58:00  

Thanks for the reply. New events are added to the database table through a separate application. The swing app is used for reporting and analysis purposes only and will not be changing the data.
Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Tuesday, July 17, 2007 @ 12:33:42  

Approximate pseudo code to implement what you are looking for.

dbTable.setSelectSql("select * from events");
dbTable.refresh();

BackgroundLoaderThread
{

public void run(){

while(shoudlLoad)
{

load new rows
Resultset rs= yourdatabaseConnection .... executeQuery("select * from events where [new rows]");
while(rs.next())
{
Vector rowData = create row data vector from resultset;
dbTable.insertSilent(rowData);
}

if(rowAdded)
{
swingUtlities.invokeLater(
{
//update the screen with new rows
dbTable.getTable().getModel().fireTableModelChanged();

//if you want to make the newly added row visible by scrolling to that row
dbTable.last();
};
}

thread.sleep(1000);

}

}

spamhurts
Private

Gender: Unspecified
Location:
Registered: Jul 2007
Status: Offline
Posts: 3

Click here to see the profile for spamhurts Send email to spamhurts Find more posts by spamhurts Edit or delete this message Reply w/Quote
Posted Tuesday, July 17, 2007 @ 20:25:52  

Exactly what I need. Thanks!
Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios