Java Reference
In-Depth Information
{
row = new Vector<Object>();
//Heterogeneous collection.
row.add(results.getInt(1));
row.add(results.getString(2));
row.add(results.getString(3));
row.add(results.getFloat(4));
rows.add(row);
}
table = new JTable(rows,heads);
scroller = new JScrollPane(table);
add(scroller, BorderLayout.CENTER);
}
catch(ClassNotFoundException cnfEx)
{
System.out.println(
"* Unable to load driver! *");
System.exit(1);
}
catch(SQLException sqlEx)
{
System.out.println("* SQL error! *");
System.exit(1);
}
}
}
The output from the above program when run with our Accounts data is shown
in Fig. 7.4 .
Fig. 7.4 Output from program JDBCGUI
Search WWH ::




Custom Search