*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Problem with creating JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Problem with creating JTable" Watch "Problem with creating JTable" New topic
Author

Problem with creating JTable

Swati krishnan
Greenhorn

Joined: Feb 09, 2001
Posts: 11
The outline below creates the JTable and creates instance of Data class. However when I compile it I get an error as follows
Undefined variable or class name: fly
return fly.getFieldInfo.length();
^
Any hints on what I am doing wrong and how to fix it
Thanks
Krishnan

package suncertify.db;
import ..
..
public class FbnModel extends JFrame
{
public void FlyTableModel() throws IOException
{
try
{
Data fly = new Data("db.db");
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
}
}
class FlyTableModel extends AbstractTableModel
{
...

public int getColumnCount()
{
return fly.getFieldInfo().length;
}
....
}
Lisa Foster
Ranch Hand

Joined: Feb 28, 2001
Posts: 116
Try declaring fly as a global in this class
Data fly;
Try this
Swati krishnan
Greenhorn

Joined: Feb 09, 2001
Posts: 11
Thanks Lisa that seemed to fix it
Appreciate your help
Krishnan
Lisa Foster
Ranch Hand

Joined: Feb 28, 2001
Posts: 116
Your Welcome
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with creating JTable