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

The Archive Base Latest Questions

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

I am writing some UI persistence methods for an application. I’m trying to expand

  • 0

I am writing some UI persistence methods for an application. I’m trying to expand to a JXTable with a fixed set of N columns in the table model.

How can I get and set the following information for column #k in the JXTable, where k is the column number in table model order? It’s not as easy as it sounds, or at least I’m missing some tricky bit of information.

  • column width
  • column visibility
  • column order

TableColumnModelExt.getColumns() includes this crazy note, which I’m having trouble parsing:

java.util.List<javax.swing.table.TableColumn> getColumns(boolean includeHidden)

Returns a List of contained TableColumns. Includes or excludes invisible columns, depending on whether the includeHidden is true or false, respectively. If false, an Iterator over the List is equivalent to the Enumeration returned by getColumns().

NOTE: the order of columns in the List depends on whether or not the invisible columns are included, in the former case it’s the insertion order in the latter it’s the current order of the visible columns.

Also, I know how to use JTable.convertColumnIndexToView(), but it returns -1 for hidden columns, and leaves no information about which order the hidden column would go if it were made visible again. JXTable knows this information because you can restore column visibility, and it puts the column where it was before it was hidden.

  • 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-27T05:39:07+00:00Added an answer on May 27, 2026 at 5:39 am

    If I understand you correctly, you are after the view column index a hidden column would have if made visible again. That’s not directly supported.

    For saving/restoring purposes, there’s a class XProperties (not officially supported, but working smoothly) doing so in the context of AppFramework which might give you an idea of how to do it.

    Edit

    To get a TableColumn by modelIndex, get all columns, loop and compare the modelIndex. Some pseudo-code in a pseudo method getColumnFor(modelIndex):

    List allColumns = table.getColumns(true);
    forEach {
       if (column.getModelIndex() == modelIndex) {
            return column;
       }
    return null;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing some application for GlassFish 2.1.1 (JavaEE 5, JPA 1.0, as far as
While writing some C code, I decided to compile it to assembly and read
Im writing some helper functions for a project im working on. I've always wanted
While writing some views to respond to ajax requests i find it somewhat strange
Just writing some CSS and I have a pretty cool Search form where you
I'm writing some console applications to move some data between SQLite databases. The classes
I'm writing some test cases, and I've got a test case that is using
I am writing some documentation and I have a little vocabulary problem: http://www.example.com/en/public/img/logo.gif is
I'm writing some code (just for fun so far) in Python that will store
I'm writing some tests for a C++ command line Linux app. I'd like to

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.