• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

problem with populating JTable from db.db

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class FlyTableModel I have put it in the suncertify.db package but methods not found also I will include my errors with this class when I compile...How do I get the reference to DataClass

package suncertify.db;
import javax.swing.table.*;
import suncertify.db.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.lang.Throwable.*;
import java.io.*;
public class FlyTableModel extends AbstractTableModel
{


Data fly = new Data("db.db");
public int getColumnCount()
{
return getFieldInfo().length;

}

public int getRowCount()
{

return getRecordCount();
}
public Object getValueAt(int row, int col)
{

String[] values = (String[])valueDInfo.toArray(new String[0]);

return values[row][col];
}
public String getColumnName(int col)
{
return getFieldInfo()[col].getName();
}

}
errors////////////////////////////////////errors/////
C:\scjd\starting\suncertify\db\FlyTableModel.java:13: Exception java.io.IOException can't be thrown in initializer.
Data fly = new Data("db.db");
^
C:\scjd\starting\suncertify\db\FlyTableModel.java:16: Method getFieldInfo() not found in class suncertify.db.FlyTableModel.
return getFieldInfo().length;
^
C:\scjd\starting\suncertify\db\FlyTableModel.java:23: Method getRecordCount() not found in class suncertify.db.FlyTableModel.
return getRecordCount();
^
C:\scjd\starting\suncertify\db\FlyTableModel.java:29: Undefined variable or class name: valueDInfo
String[] values = (String[])valueDInfo.toArray(new String[0]);
^
C:\scjd\starting\suncertify\db\FlyTableModel.java:31: [] can only be applied to arrays. It can't be applied to java.lang.String.
return values[row][col];
^
C:\scjd\starting\suncertify\db\FlyTableModel.java:39: Method getFieldInfo() not found in class suncertify.db.FlyTableModel.
return getFieldInfo()[col].getName();
^
6 errors
Process completed with exit code 1
Thanks in Advance Ray
also when I want to populate my JTable from the client is this appropiate::::::given my above class:::::
FlyTableModel model = new FlytableModel();
JTable table = new JTable(model);
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic