Package Project02_order_management.util;import Java.sql.resultset;import Java.sql.sqlexception;import Javax.swing.jtable;import javax.swing.table.defaulttablemodel;/** * A JTable tool class <br> * Initialize table data * * @author Martin Dong * */public class Tableutil {/** * declares the table control */private static JTable jtable;/** * Initializes the default data model */private static default TableModel dtm;/** * Initialize jtable control * * @param rst * Incoming result set * @param columnnames * table header for incoming table * @return Returns the JTable control entity */public static JTable inittable (ResultSet rst, string[] columnnames) {DTM = new DefaultTableModel (Initdate ( RST, columnnames), ColumnNames) {public boolean iscelleditable (int row, int column) {return false;}}; jTable = new jTable (DTM); return jTable;} /** * Initialize default data Model * * @param rst * Incoming result set * @param columnnames * table header for incoming table * @return return two-dimensional data */public Static object[][] Initdate (ResultSet rst, string[] columnnames) {object[][] rowdate = null;if (rst! = NULL) {//move cursor to last row of The ResultSet object. In order to get all the data row try {Rst.last (); rowdate = new Object[rst.getrow ()][columnnames.length];int index = 0;//move to the first data wade is behind the Traverse Rst.first ();// Since it is necessary to traverse from the first one, a row of data is moved up from the first record rst.previous (), while (Rst.next ()) {for (int j = 0; J < Columnnames.length; J + +) {Rowdate[i NDEX][J] = Rst.getobject (j + 1);} index++;}} catch (SQLException e) {//TODO auto-generated catch Blocke.printstacktrace ();}} return rowdate;}}
Android Pull parsing xml