Help with JList
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 problem 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
listModelMsg = new DefaultListModel();
String msgList = "SELECT msg_text FROM msg_board ORDER BY msg_id ASC";
this.resultSet = this.connection.executeQuery(msgList);
I'll be honest that I find that when I was doing heavy GUI work in my undergrad I came up with this problem frequently.
And to be honest I can't remember how I fixed it, however I did find a helpful link on how repaint works:
My only suggestion is to try and add validate() before the repaint.
Or put an int parameter in there. Besides that I'm unsure and if there is a more stable solution I'd like to hear it as well.