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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:47:30+00:00 2026-06-16T03:47:30+00:00

Possible Duplicate: How to make a columns in JTable Invisible for Swing Java How

  • 0

Possible Duplicate:
How to make a columns in JTable Invisible for Swing Java
How to hide a particlar column in DefaultTableModel from displaying it in table?

I am trying to enter data to three columns in JTable, but I want to show only two columns. Actually, I want to hide the third column, not by setting the width to 0, but by any other method in which I can get the data from the hidden column on a click event.

How can I hide a column in this manner?

I am using the following code:

 try {
     String Title[]= new String{"a","b","c"};
     Object obj= new Object[50][3];
     JTable table= new JTable(obj,title);
     JScrollPane jsp= new JScrollPane(table); 
     add(jsp);
 } catch(Exception ex) {
     ex.printStackTrace();
 }
  • 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-16T03:47:31+00:00Added an answer on June 16, 2026 at 3:47 am

    Set the Column Minimum and Maximum width as zero.

    table.getColumnModel().getColumn(columnIndex).setMinWidth(0);
    table.getColumnModel().getColumn(columnIndex).setMaxWidth(0);
    

    As suggested by Andrew Thomson in the comment section you can also use removeColumn.

    From javaDoc;

    removeColumn

    public void removeColumn(TableColumn aColumn) 
    

    Removes aColumn from this JTable’s array of columns. Note: this method does
    not remove the column of data from the model; it just removes the
    TableColumn that was responsible for displaying it. Parameters:
    aColumn – the TableColumn to be removed

    P.S: But I have personally used the first approach to hide a column in the JTable. Thanks for removeColumn method I will try to use it from now on.

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

Sidebar

Related Questions

Possible Duplicate: Make iPhone app paid version replace free version on install from app
Possible Duplicate: How can I make an EXE file from a Python program? i
Possible Duplicate: Platform independent paths in Java I make a program but it save
Possible Duplicate: T-SQL Group Rows Into Columns I have a table _data that is
Possible Duplicate: How to make drag-and-drop from one list to another in C#/WindowsForms? I
Possible Duplicate: How to make pipes work with Runtime.exec()? Hello i wrote simple java
Possible Duplicate: MySql select format, round column When i make a SQL query using
I have a table where duplicate entries in one of the columns is possible
Possible Duplicate: SQL update query using joins Table 1 has 2 columns: Has an
Possible Duplicate: Extracting dollar amounts from existing sql data? I have a column in

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.