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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:58:25+00:00 2026-06-19T03:58:25+00:00

I have a problem in the display of two different JTables which are created

  • 0

I have a problem in the display of two different JTables which are created by the same AbstractTableModel. I don’t really think that is important to show the code of the AbstractTableModel, but if I am asked for I may present it as well.

I just call two times the same class that extends this AbstractTableModel for two arraylists that I am using to create the tables.

final SwitchTableModel model = new SwitchTableModel(user_decide);
final SwitchTableModel model1 = new SwitchTableModel(duplicates);
JTable table = new JTable(model);
JTable table1 = new JTable(model1);

JFrame frame = new JFrame ("Results");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JPanel grid = new JPanel();
grid.add(toolbar);
grid.add(toolbar1);
grid.add(table);
grid.add(table1);
frame.add(grid);
frame.pack();
frame.setVisible(true);

I also create the toolbars which are the same, I also think that this is irrelevant, that is why I don’t post the code – I would do it if you think it is needed.

The problem is that in the end I see the same JTable two times, so I suppose it has something to do with the way that I call the class.

  • 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-19T03:58:26+00:00Added an answer on June 19, 2026 at 3:58 am

    The problem comes from an inappropriate static keyword.:

    public static int [][] data;
    

    static means that the value of that variable will be the same for all your instances. Instead, put your data inside your SwitchTableModel and don’t make it static. This will solve your issues immediately.

    Something like:

    public class SwitchTableModel extends AbstractTableModel {
        private int[][] data;
        //... the rest of your current code.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF program with two listviews which display information from two different
I have a report page that can display two different reports. So I have
I have an strange problem using two borders. I use them to display video
I have to display Datetime in my gridview, the problem is that while I
I have two screens that are using the same resolution (1280x1024), but one of
I have two different windows, one will to display streams on a image and
Hello I am trying to display two different html pages through the same UIViewController
I have implemented UILocalNotifications in two different apps now. One uses Location Services, which
I am creating a website in which I have two different buttons. By using
I have a sub navigation which is placed in two different places on different

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.