Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-09-2007, 08:25 PM
Senior Member
 
Join Date: Jun 2007
Posts: 114
Albert is on a distinguished road
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

Code:
//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); }
Thanks
Albert
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-13-2007, 04:42 PM
Member
 
Join Date: Jul 2007
Posts: 44
susan is on a distinguished road
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:

http://mindprod.com/jgloss/repaint.html


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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
JList problem zizou147 Advanced Java 1 04-17-2008 09:50 AM
searching within a JList newtojava7 New To Java 1 03-10-2008 01:12 AM
Dialog and JList Doubts hemanthjava AWT / Swing 0 12-05-2007 09:42 PM
help with drag and drop on JList ysl530 AWT / Swing 3 08-13-2007 06:38 PM
add a jlist column Alan JCreator 1 05-28-2007 05:51 AM


All times are GMT +3. The time now is 10:05 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org