Blade_runner
03-08-2007, 07:51 AM
Hi
Could someone help,i have a TextArea that a user enter text then submits the text to the database, i have a jlist that retrieves the text and displays it. the proble is the list does not update immediately i have tried repainting the list but it seems not to work.
the Jlist code on post-creation
//code
listModelMsg = new DefaultListModel();
String msgList = "SELECT msg_text FROM msg_board ORDER BY msg_id ASC";
try
{
this.resultSet = this.connection.executeQuery(msgList);
while(this.resultSet.next())
{
listModelMsg.addElement(this.resultSet.getString("msg_text"));
}
jList12.repaint();
jList12.setModel(listModelMsg);
}
catch(SQLException e)
{
e.printStackTrace(System.err);
}
Any help is welcome.
Could someone help,i have a TextArea that a user enter text then submits the text to the database, i have a jlist that retrieves the text and displays it. the proble is the list does not update immediately i have tried repainting the list but it seems not to work.
the Jlist code on post-creation
//code
listModelMsg = new DefaultListModel();
String msgList = "SELECT msg_text FROM msg_board ORDER BY msg_id ASC";
try
{
this.resultSet = this.connection.executeQuery(msgList);
while(this.resultSet.next())
{
listModelMsg.addElement(this.resultSet.getString("msg_text"));
}
jList12.repaint();
jList12.setModel(listModelMsg);
}
catch(SQLException e)
{
e.printStackTrace(System.err);
}
Any help is welcome.