|
JList? You want a JTable for that. If you're looking for something to put a database query into a JTable, the June 2001 issue of Java Pro magazine (http://www.java-pro.com) has an article that describes a reusable way of doing that. PC2 -----Original Message----- From: Xu, Weining [mailto:Weining.Xu@AIG.com] Sent: June 4, 2001 13:18 To: 'JAVA400-L@midrange.com' Subject: RE: IMulticolumnListbox class Thanks. If I use JList, what method I could use to add the resultSet array to the JList as the following example did? psAllRecord is a PreparedStatement object which select all records from a table (Using JDBC). The following code segment is to assign the values of resultSet to an array, then add the string array into the list box. public void populateListBox(){ java.sql.ResultSet rs = null; try{ rs = psAllRecord.executeQuery(); while (rs.next()){ String[] array = new String[5]; array[0] = rs.getString("PARTNO"); array[1] = rs.getString("PARTDS"); array[2] = insertSpaces(Integer.toString(rs.getInt("PARTQY")), 5); array[3] = insertSpaces(rs.getBigDecimal("PARTPR", 2).toString(), 8); array[4] = rs.getDate("PARTDT").toString(); ivjIMulticolumnListbox1.addRow(array, array[0]); } } catch (Exception e){ showException(e); } } Basically I have a set of results from AS400 DB table, and I want added them into a JList or JTable. +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.