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 8271389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:49:40+00:00 2026-06-08T06:49:40+00:00

In my UI I am using a JTable with a TableModel.In a update method

  • 0

In my UI I am using a JTable with a TableModel.In a update method of the implemented Observer interface i am calling the repaint method.The delete operations take place immediately while on adding a row it is not updated,but it is updated while switching through tabs( which calls another method instead of repaint)

This is code for update method:

 public void update(Observable o, Object arg) {
        ((MyTableModel)table_.getModel()).addTableRow(row);

    //addTable(row) adds the  row to the dataVector that populates the JTable
    //the dataVector is updated with added row

            table_.repaint();

            }

I wanted to know why the JTable is not getting updated
Please Note->the data Vector has the required rows including the added row

  • 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-08T06:49:41+00:00Added an answer on June 8, 2026 at 6:49 am

    Your addTableRow method should also fire an event indicating the row has been added to alert the JTable of this change. Then there is no need for the repaint call.

    Take for example a look at the implementation of the addRow method of the DefaultTableModel:

    public void insertRow(int row, Vector rowData) {
        dataVector.insertElementAt(rowData, row);
        justifyRows(row, row+1);
        fireTableRowsInserted(row, row);
    }
    

    You can clearly see that an event is fired, and no repaint needed. This is all explained in more detail in the JTable tutorial

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

Sidebar

Related Questions

I have a JTable which is created using a TableModel JTable t = new
I can't figure out something using the constructor JTable(TableModel dm) . I'm using a
I have a JTable that is populated using a custom TableModel I created. I
I'm currently using JTable to show the contents in database. I want to provide
I tried to add JRadioButton into JTable by using CellEditor and CellRenderer , but
Im having trouble getting my JTable that im using to display either check boxes
I am using DefaultTable Model for showing my records in Jtable.But there is a
I am using an XPTable (http://www.codeproject.com/Articles/11596/XPTable-NET-ListView-meets-Java-s-JTable) and try to add a comboBox column. The
I want to color specific rows in jTable..i did it for columns by using
I am populating Employee Data in JTable using Netbeans. I want to add Radiobutton

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.