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

  • Home
  • SEARCH
  • 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 3333822
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:50:18+00:00 2026-05-17T23:50:18+00:00

I have two JTables that I would like displayed in one window. Currently I

  • 0

I have two JTables that I would like displayed in one window. Currently I am able to display only one of the tables using:

JTable table1 = makeTable(1);
JTable table2 = makeTable(2);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JScrollPane scrollPane1 = new JScrollPane(table1);
JScrollPane scrollPane2 = new JScrollPane(table2);
frame.add(scrollPane1, BorderLayout.CENTER);
frame.validate();
frame.add(scrollPane1, BorderLayout.CENTER);
//frame.add(scrollPane2, BorderLayout.CENTER);
frame.setSize(700, 500);

frame.setVisible(true);
frame.validate();

What is the simplest way to display multiple tables, one on top of the other (though orientation is irrevelant) using Swing?

  • 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-17T23:50:19+00:00Added an answer on May 17, 2026 at 11:50 pm

    You can’t add both JTables to the same position in the BorderLayout.

    What you can do is the following:

    frame.add(scrollPane1, BorderLayout.CENTER);
    frame.add(scrollPane2, BorderLayout.SOUTH);
    frame.validate();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two screens that are using the same resolution (1280x1024), but one of
I have two tables that are set up, one named users and one named
I have two JTables. One is for the list of invoices and the other
Have two events: $('body').mouseup(function(e){} and $('.toggle').click(function(e){} I only want one of these to trigger.
Have two sets of data (two tables) for patient records, one 1999-2003, the other
Have two issues one is showFromToolbar statement format warning issue and another is that
have two three tables one for student, second for class, and the third for
Have two scripts that give very different results. First using csv.reader and it works
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two tables images2 and image_data So the goal is to have 1

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.