I am studying some Java DB applications of the JavaCore vol II book.
Running a large sample application of that book gives my the following error:
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: learningdatabase.DataPanel.<init>(Ljavax/sql/RowSetV
at learningdatabase.ViewDBFrame.showTable(ViewDB.java :154)
at learningdatabase.ViewDBFrame$1.actionPerformed(Vie wDB.java:54)
Who can give me a clue what this error is about?
Next see the class attached to concerning error number (it is an independent class at the same file).
154 dataPanel = new DataPanel(crs);
class DataPanel extends JPanel { /** * Constructs the data panel. * @param rs the result set whose contents this panel displays */ public DataPanel(RowSet rs) throws SQLException { fields = new ArrayList<JTextField>(); setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = 1; gbc.gridheight = 1; ResultSetMetaData rsmd = rs.getMetaData(); for (int i = 1; i <= rsmd.getColumnCount(); i++) { gbc.gridy = i - 1; String columnName = rsmd.getColumnLabel(i); gbc.gridx = 0; gbc.anchor = GridBagConstraints.EAST; add(new JLabel(columnName), gbc); int columnWidth = rsmd.getColumnDisplaySize(i); JTextField tb = new JTextField(columnWidth); if (!rsmd.getColumnClassName(i).equals("java.lang.String")) tb.setEditable(false); fields.add(tb); gbc.gridx = 1; gbc.anchor = GridBagConstraints.WEST; add(tb, gbc); } } /** * Shows a database row by populating all text fields with the column values. */ public void showRow(ResultSet rs) throws SQLException { for (int i = 1; i <= fields.size(); i++) { String field = rs.getString(i); JTextField tb = (JTextField) fields.get(i - 1); tb.setText(field); } } /** * Updates changed data into the current row of the row set */ public void setRow(RowSet rs) throws SQLException { for (int i = 1; i <= fields.size(); i++) { String field = rs.getString(i); JTextField tb = (JTextField) fields.get(i - 1); if (!field.equals(tb.getText())) rs.updateString(i, tb.getText()); } rs.updateRow(); } private ArrayList<JTextField> fields; }