• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with creating JTable

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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;
}
....
}
 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your Welcome
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic