Results 1 to 2 of 2

Thread: Help with JList

  1. #1
    Albert is offline Senior Member
    Join Date
    Jun 2007
    Rep Power

    Default 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

    Java Code:
    listModelMsg = new DefaultListModel();
    String msgList = "SELECT msg_text FROM msg_board ORDER BY msg_id ASC";
    this.resultSet = this.connection.executeQuery(msgList);
    catch(SQLException e)

  2. #2
    susan is offline Member
    Join Date
    Jul 2007
    Rep Power


    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.

Similar Threads

  1. help with drag and drop on JList
    By ysl530 in forum AWT / Swing
    Replies: 4
    Last Post: 01-22-2011, 05:58 PM
  2. JList problem
    By zizou147 in forum Advanced Java
    Replies: 1
    Last Post: 04-17-2008, 08:50 AM
  3. searching within a JList
    By newtojava7 in forum New To Java
    Replies: 1
    Last Post: 03-10-2008, 01:12 AM
  4. Dialog and JList Doubts
    By hemanthjava in forum AWT / Swing
    Replies: 0
    Last Post: 12-05-2007, 09:42 PM
  5. add a jlist column
    By Alan in forum JCreator
    Replies: 1
    Last Post: 05-28-2007, 04:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts