Posted on 2005-05-12
Last Modified: 2013-11-23
Currently I am working on a GUI dealing with JTable.
I am having a problem with one of my JTable.

In my the following code:

JPanel p3 = new JPanel(new GridLayout(2,1));
tableProcedure = new JTable();

where I am suppose to set the tablemodel.

I have also created my own table model with the file name

The problem I am facing is to create the tablemodel for procedure.

HealthService is the controller class. Health service is link to an abstract class MedicalFacility. MedicalFacility has two sub classes Hospital and HealthClinic. The Hospital is link to the procedure.

As for my other table models it works fine, but for procedureDefaultModel im having problems.

How do I solve this problem?

You can download the code from

Your help is kindly appreciated.


Question by:eugene007

    Author Comment

    I have tested it this way:

    JPanel p3 = new JPanel(new GridLayout(2,1));
    MedicalFacility m = new Hospital("GH",0.5);
    prdm = new procedureDefaultModel(m);  
    tableProcedure = new JTable(prdm);

    in my

    and I can view all the columns in my GUI.

    However this is static. Its a problem.

    Author Comment

    I found the solution:

    In my I did this:

    JPanel p3 = new JPanel(new GridLayout(2,1));        
    prdm = new procedureDefaultModel(null);  
    tableProcedure = new JTable(prdm);

    and in my

    public int getRowCount()
         return 0;
         return ((Hospital)mf).getProcedures().size();
    LVL 86

    Expert Comment

    Post a 0-pointer to CS and they'll give you your points back:
    LVL 1

    Accepted Solution

    PAQd, 60 points refunded.

    Community Support Moderator

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
    Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
    Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now