Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7775367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:36:47+00:00 2026-06-01T17:36:47+00:00

So i am working with a JTable , It has Columns A-K . with

  • 0

So i am working with a JTable, It has Columns A-K. with A and B being the only editable ones. If someone edits an empty row in A, I make an API call to get B then i make a DB call to get all rows where B exists.If someone edits an empty row in B, i make the same call as the will be retrieved from the DB for that row as well. The call returns 0-N rows. If 0 rows were returned, I change the values of all row except B to N/A otherwise i populate the rows using the data.Once populated, i make all columns non-editable. The DB call occurs in its own thread as once the call is return i create my own record object which I add to the tablemodel.

I have my own TableModel and a TableModelListener to keep the data and handle changes in values.

Here is my issue. I am using TableCellRenderer and using the cellrenderer to see if the value was changed, if so then i make the calls and populate as needed. When a large number of rows is being pulled from DB, it takes a while to load and making all that records so I tried to use a ProgressBar to show the user that the screen isn’t just frozen, it is progressing and by how much. However the frame that comes up is blank and nothing gets displayed. I get the feeling i am doing something either improperly or missing something.Any help much appreciated.

some code to understand what i am talking about

public class MyPanel extends JPanel {
    private JTable myTable;
    private MyTableModel tm;
    //OTHER FIELDS

    public static void createPanel() {
           tm = new MyTableModel(columnnames);
           myTable = new JTable(tm);

           TableColumn account = myTable.getColumnModel().getColumn(
            MyTableModel.ACCOUNT_INDEX);
    account.setCellRenderer(new MyTableRenderer(
            MyTableModel.ACCOUNT_INDEX));
    }
}

public class MyTableRenderer extends DefaultTableCellRenderer{

   protected int interactiveColumn;

   public MyTableRenderer(int interactiveColumn) {
        this.interactiveColumn = interactiveColumn;
    }

   public Component getTableCellRendererComponent(JTable table,
            Object value, boolean isSelected, boolean hasFocus, int row,
            int column) {
        Component c = super.getTableCellRendererComponent(table, value,
                isSelected, hasFocus, row, column);
        if (column == interactiveColumn && hasFocus) {
             //DO DB and API CALLS HERE
             //IF DB CALL DISPLAY A NEW FRAME WITH PROGRESSBAR
        }
        return c;
   }
}

Sorry for formatting issues

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:36:48+00:00Added an answer on June 1, 2026 at 5:36 pm

    Use SwingWorker, which allows you to update your TableModel as you examine your result set.

    Addendum: Don’t try to update the TableModel from the renderer. You can update the model when your implementation of CellEditor has concluded, by starting a suitable worker in getCellEditorValue(). In that way, the revised data will be available when the renderer is next invoked for any modified cell(s). This related example outlines the approach.

    Addendum: getCellEditorValue() is invoked after editing has concluded, but starting the worker in setValueAt() offers more reliable access to the target row and column.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working with a JTable that contains a few columns with different datatypes
I am working in JTable and I have a requirement like this. Say There
How to make the jList selectable and jScrollPane scrollable inside a jTable. This is
I have a JTable where the first column in each row is a checkbox.
Working with an API where I need to send a value over in an
I'm working on simple UI that has a scala.swing.Table component. I'd like to sort
I'm working with a JTable , whose cells data are contained in Object .
How can i add data to JTable while working with netbeans. Netbeans in it's
I am working on a Java GUI, in which i have a JTable in
I'm trying to have a JTable edition working like in excel: if I start

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.