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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:47:53+00:00 2026-05-23T11:47:53+00:00

I have populated a JTable from file. After populating data into JTable i can

  • 0

I have populated a JTable from file. After populating data into JTable i can edit the
data but the changes i made to the data are not applied. I want the changes to be applied and later i want to save the updated data into file.

Below is the code to populate the table

ArrayList arrayList1 = new ArrayList();
ArrayList arrayList  = new ArrayList();
reader = new BufferedReader( new InputStreamReader( new FileInputStream( mainpath ) ) );
Map<String, Object[]> result = new LinkedHashMap<String, Object[]>();
int count = 0;
int i = 0;
boolean b = false;
int r1 = rcount - 1;
while( reader.ready() ) {
    String line = reader.readLine();
    if( count == 0 )
        count++;
    else {
        String[] values = line.split( "," );
        String vit = values[0];
        String amt = values[1];
        String rda = values[2];
        String brand = values[3];
        String product = values[4];
        int rcount1 = Integer.parseInt( values[5] );
        if( rcount1 == r1 ) {
            if( result.containsKey( vit ) ) {
                result.clear();
                result.put( vit, new Object[] { b, vit, amt, rda } );
                arrayList = new ArrayList( result.values() );
                for( Object v : arrayList ) {
                    arrayList1.add( v );
                }
            } else {
                if( arrayList.size() > 0 ) {
                    arrayList.clear();
                    result.clear();
                }
                result.put( vit, new Object[] { b, vit, amt, rda } );
                arrayList = new ArrayList( result.values() );
                for( Object v : arrayList ) {
                    arrayList1.add( v );
                }
            }
            combo.setSelectedItem( brand );
            combo1.setSelectedItem( product );
        }
    }
}
jTable3.setModel( new AnimalTableModel( arrayList1 ) );

First column is a checkbox, second col a combobox, third col accepts floats, fourth accepts integers.

Any suggestions would be really helpful….

Thanks in advance

  • 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-05-23T11:47:54+00:00Added an answer on May 23, 2026 at 11:47 am

    to add an item…

    jTable3.getModel().getWhateverFunctionGetsYourArray().add(item);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have populated a Datatable, from 2 different servers. I am able to make
I have a GridView populated from an ObjectDataSource with two items in its DataKeyNames
I have a DataSet populated from Excel Sheet. I wanted to use SQLBulk Copy
I have a model being populated by my data layer and then I have
I have a radajaxpanel that is populated with the selected item from a combobox
We have a simple project where we read data from a socket and we
I have a UITableView populated with a bunch of music players that I've made
I have an NSArray populated with 0's and 1's. How can I return the
I have a listview populated by a text file hosted on my website that
I have populated swt Table and it displays it OK, but now I want

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.