Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with creating JTable

 
Swati krishnan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try declaring fly as a global in this class
Data fly;
Try this
 
Swati krishnan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Lisa that seemed to fix it
Appreciate your help
Krishnan
 
Lisa Foster
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your Welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic