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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:27:06+00:00 2026-05-31T07:27:06+00:00

My use case is as follows — I have a list(ArrayList) of objects, custom

  • 0

My use case is as follows —
I have a list(ArrayList) of objects, custom data objects.
Now i want to display or represent each of these data objects as a Box containing 3 buttons. So i would have n Boxes for n given data objects in my list.

I want each of these ‘boxes’ to be stacked in a , say, JTable.

Now, whenever a data object is added to the aforementioned list, i want another Box to be created as mentioned before and added to the JTable.

I know this can be accomplished using PropertyChangeListener but i went through some articles online regarding PropertyChangeListener but was not able to get a clear implementable idea.

im new to building UIs and any help with this would be much appreciated.

  • 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-31T07:27:08+00:00Added an answer on May 31, 2026 at 7:27 am

    I would recommend wrapping your ArrayList within a TableModel implementation, whereby modifications to the list will fire a TableModelEvent.

    In the example below the underlying List is encapsulated within the model implementation; the only way to modify it is by calling addItem, which will call fireTableRowsInserted after modifying the list. This will result in a TableModelEvent being fired and subsequently processed by the JTable view onto this model instance.

    public class MyTableModel extends AbstractTableModel {
      private final List<MyItem> items = new ArrayList<MyItem>();
    
      public int getRowCount() {
        return items.size();
      }
    
      public int getColumnCount() {
        return 3;
      }
    
      public String getColumnName(int columnIndex) {
        switch(columnIndex) {
          case 0:
            return "foo";
          case 1:
            return "bar";
          case 2:
            return "qux";
          default:
            assert false : "Invalid column index: " + columnIndex;
        }
      }
    
      public void addItem(MyItem item) {
        items.add(item);
        fireTableRowsInserted(items.size() - 1, items.size() - 1);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Use case: I've just entered insert mode, and typed some text. Now I want
My use case is as follows -- I have a database table with around
I have a Java Applet application. The use case is as follows: The users
The use case is as follows : I have a script that runs a
My use case is this, I want to call out to a webservice and
My use case is very simple : I have a GUI application, and inside
The use case I want to achive is. 1. Fetch XML from a remote
Specifically, if I use NInject to create a bunch of objects that have been
My use case is as follows: I would like to find all occurrences of
I have a rather simple use case. The actor is a manager who provides

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.