KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > in > co > daffodil > db > jdbc > Display


1 /**
2 * Copyright (c) 2003 Daffodil Software Ltd., India all rights reserved.
3 * This library is free software; you can redistribute it and/or modify
4 * it under the terms of version 2.1 of the GNU Lesser General Public License as
5 * published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public License
13 * along with this library; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */

16
17
18 package in.co.daffodil.db.jdbc;
19
20
21
22 public class Display
23 {
24
25 /* public static void showResultSet(ResultSet rs) throws Exception{
26     ResultSetMetaData metaData = rs.getMetaData();
27     int columnCount = metaData.getColumnCount();
28     Object[] displayColumn = new Object[columnCount];
29     for(int i=1;i <= columnCount;i++)
30       displayColumn[i-1] = metaData.getColumnName(i);
31     ArrayList result = new ArrayList(10);
32     while(rs.next()){
33       Object[] columnValues = new Object[columnCount];
34       for(int i=1;i<=columnCount;i++)
35         columnValues[i-1] = rs.getObject(i);
36       result.add(columnValues);
37     }
38
39     Object[][] data = new Object[result.size()][];
40     result.toArray(data);
41
42     JFrame jframe = new JFrame();
43     jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
44     jframe.addWindowListener(new MyWindowAdapter() );
45     JScrollPane jsp = new JScrollPane();
46
47     JTable jTable = new JTable(data,displayColumn);
48     jsp.setViewportView(jTable);
49
50     jframe.getContentPane().add(jsp);
51     jframe.setSize(350,400);
52     jframe.show();
53   }*/

54 }
55
56 /*class MyWindowAdapter extends WindowAdapter{
57    public void windowClosed(WindowEvent e) {
58      Window w = e.getWindow();
59      w.hide();
60    }
61 }*/

62
Popular Tags