This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes problem with populating JTable from db.db Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "problem with populating JTable from db.db" Watch "problem with populating JTable from db.db" New topic
Author

problem with populating JTable from db.db

Randy Valadez
Greenhorn

Joined: Feb 08, 2001
Posts: 21
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);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with populating JTable from db.db
 
Similar Threads
help needed in Jtable using AbstractTableModel
JTable
Null Pointer Exception in JTable
Help on Displaying Query Result in JTable
Problem with creating JTable