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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:22:39+00:00 2026-05-27T21:22:39+00:00

I Have a JTable (or a JXTable to be more precise) with 3 sections

  • 0

I Have a JTable (or a JXTable to be more precise) with 3 sections of grouped columns I want to divide.
I used to have 3 tables which i programmatically linked (the scrollbar position, the sorting, the selection). I used a lot of code to get this linked, and I want to get rid of this.
Now I Am switching to 1 JXTable, because there are some things a lot nicer in this table class.

I found some (not very satisfying) solutions to almost the same problem.
Maybe some one has a good suggestion for me.

Option 1: an empty column as a divider (another color, like gray) and programatically hop over this empty column when using the arrows or tab keys.

option 2: setting the margin for just 1 side of 1 column to a larger size, so it seems like a divider. Untill now I have only found out how to set the margins for all columns

option 3: getting back to 3 seperate tables again (especially to get the tables sorted in the same way is a lot of work, because I do not want to repeat the columns in the seperate sections). This means I have to rewrite my table sorter, sorting on a non-visible column.

any suggestion is welcome (also if it’s none of the three given options)

  • 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-27T21:22:39+00:00Added an answer on May 27, 2026 at 9:22 pm

    I’ve made something that looks somewhat like what you’re going for by overriding the cell renderer on the 3rd column to have a thick right border and no other borders. You could do the same within the table column header to have the border extend up through there. It’s clearly placing the border within the cell but this may be sufficient for you.

      {
        ....
        table.getColumnModel().getColumn(2).setCellRenderer(
            new ThickRightBorderCellRenderer());
        ....
      }
    
      private static class ThickRightBorderCellRenderer
              extends DefaultTableCellRenderer {
    
        @Override
        public Border getBorder() {
          return BorderFactory.createMatteBorder(0, 0, 0, 3, Color.BLACK);
        }
      }
    

    Example

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

Sidebar

Related Questions

I have a JTable that I want to use to display some data (a
I have a JTable with two columns and both are JComboBox, for this purpose
I have a Jtable on which I called the method table1.setAutoCreateRowSorter(true); . So this
Suppose you have a JTable and for each cell you want to display three
I have a JTable which is held in a scrollpane, which in turn sits
I have a JTable and inside on of the columns I have a JComboBox.
I have a JTable and I need to be able to reorder the columns.
I have a JTable with JLabel[][] as data. Now I want to detect a
I have a JTable which has 1st row blank. Now when I sort the
i have jtable filed with data. i want to create java code for Action

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.