Results 1 to 2 of 2
Thread: Add JList item from resultset
- 06-17-2010, 10:21 AM #1
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 10
Add JList item from resultset
Hi, I searched how to add items in JList and try it. It adds in JList but there is something wrong. Please see the picture. All that I try has same results.
pic1 - shows that JList does not contain the items that I add.. or does not refresh
pic2 - is alsmost the same with pic1, only a scrollbar is added.Which means that the items are added, it just did not show.
pic3 - I click the scrollbar and the two items that I added show.
I think I am missing something.
Here is the latest code that I tried
Java Code://[b]from FormUtility class[/b] public static void loadtolist(String sql, JList lists) { ... DefaultListModel lm = new DefaultListModel(); ... try { lm.clear(); do { rs.absolute(iRow + 1); lm.addElement(rs.getObject(1).toString()); iRow = iRow + 1; } while(rs.next()); .... lists.setModel(lm); ... }
Thanks in advance,
geje
- 06-17-2010, 10:47 AM #2
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 10
Similar Threads
-
JToolbar: How to unselect first item
By mjones in forum AWT / SwingReplies: 4Last Post: 02-19-2010, 03:56 AM -
taking data from several textfields and combining them to be one item in a JList
By Ekul in forum New To JavaReplies: 3Last Post: 11-11-2009, 10:00 PM -
Remove an item from listbox
By Dieter in forum Advanced JavaReplies: 9Last Post: 09-21-2009, 11:40 PM -
Extract item from a string
By firewalll in forum New To JavaReplies: 2Last Post: 09-02-2009, 06:00 AM -
grabbing an item from an arraylist.
By newtojava7 in forum New To JavaReplies: 1Last Post: 03-17-2008, 09:25 PM
Bookmarks