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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:55:34+00:00 2026-05-24T15:55:34+00:00

I’ve been reading the Swing tutorial How to Use Tables , and although it

  • 0

I’ve been reading the Swing tutorial “How to Use Tables“, and although it has been very informative for the JTable newbie, I am instantly hitting roadblocks the second I try to veer away from the examples and strike out on my own.

So, if you want your Swing app to have a nifty, custom table, it looks like their are several core classes you’ll be working with at the very least:

  • JTable
  • TableModel
  • TableModelListener
  • TableModelEvent
  • TableColumnModel
  • TableColumnModelListener
  • TableColumnModelEvent
  1. Just from reading the tutorials and JavaDocs, it is not obvious to me what the difference is between a TableModel and a TableColumnModel, and how they relate to each other. Obviously, the column model pertains just to a single column or all the columns (?), whereas the table model is more general. But how do they relate to one another? What areas of responsibility does each one handle? Does TableModel manage, control or somehow contain the TableColumnModel?

  2. Closely related to the first question, in which model do I specify cell editors and renderers?

  3. I assume that, for each of these objects I should subclass/implement them so I can customize them for my project. Is that the generally-accepted way of customizing tables (subclassing the JTable “core” classes), or are these powerful enough to support any kind of table creation?

  • 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-24T15:55:35+00:00Added an answer on May 24, 2026 at 3:55 pm

    Usually, you just define a TableModel (by subclassing AbstractTableModel), and construct a JTable instance with this table model as argument.

    If you implement getColumnClass() correctly in your table model, JTable will automatically choose an appropriate renderer for each of your column. If some cells are editable (you tell by overriding isCellEditable() in the table model), the appropriate cell editor will also be associated with the column. You’ll have to trigger events (using one of the fireXxx methods in AbstractTableModel) when the model changes.

    Of course, if you have special objects in your cells (i.e. something other than String, Boolean, Integer, etc.), you’ll have to associate a renderer to a column (and an editor if the cells in these cells are editable). This is done by setting the renderer/editor on the column of the column model. The column model is automatically created by the JTable from the table model, though. You usually don’t have to creat one by youself.

    So, to answer your specific questions:

    1. TableModel is used to hold the data displayed in the JTable. You must implement it yourself. TableColumnModel is automatically created by the JTable and is typically used to associate a renderer and editor to specific columns.
    2. If you want a specific renderer for the nth column, you get the nth column from the column model of the JTable, and you set a renderer on this column.
    3. Usually subclassing AbstractTableModel is sufficient.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I'm looking for suggestions for debugging... If you view this site in Firefox or
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and

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.