Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 creating JTable

 
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;
}
....
}
 
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
 
Does this tiny ad smell okay to you?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic