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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:23:03+00:00 2026-05-13T16:23:03+00:00

I am attempting to create my own custom TableModel for my JTable (because I

  • 0

I am attempting to create my own custom TableModel for my JTable (because I would like to incorporate a row of JCheckBox’s into my table.) I have the JTable in a JScrollPane as well. Before I attempted to incorporate the JCheckBox and custom AbstractTableModel, the JTable would show up fine if I used the default (Object[][], Object[]) constructor. I read in the JTable tutorial on Sun that those constructors use a default of treating all data as Strings.

I then created my custom AbstractTableModel and went from this:

JTable table = new JTable(dataArray, col);

To This:

JTable table = new JTable();

I am assuming that this would call attempt to create the JTable with the custom-made class that extends AbstractTableModel, but now nothing shows up in the JScrollPane.

I am using this incorrectly? I virtually copied the code from the Sun tutorial and only changed the names of the datafiles involved. I also placed this method in the same class. Is there a different way to make sure that your table is created with your custom Table Model? Any insight would appreciated.

  • 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-13T16:23:03+00:00Added an answer on May 13, 2026 at 4:23 pm

    JTable has several constructors that take a TableModel as a parameter. Is that what you’re looking for? From the code snippet you supplied, it seems like you’re calling the default constructor and expecting it to use your custom table model somehow. (Maybe there’s some code missing that does this?). If you use the default constructor, JTable will internally create a DefaultTableModel instance and use that.

    Edit:
    Comments don’t take code very well, so adding here: To get the table to use your model, you would do something like this:

    MyTableModel model = new MyTableModel();
    // ...initialise model if required
    JTable table = new JTable(model);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to create my own custom Autocomplete style dropdown control in c#
I'm attempting to create my own custom ToolTip for a program I've ported to
I'm attempting to create a custom calendar control that inherits from ASP.Net's built in
I'm attempting to load a dll into MSSQL with: USE dbname GO CREATE ASSEMBLY
Attempting to insert an escape character into a table results in a warning. For
I'm attempting to create my own templates for the search pages using drupal 6.
I'm currently attempting to create a tabbed interface in a web application, and based
I am attempting to create a small application to collect data received from an
I am attempting to create new membership users in an Ektron CMS400.NET-based website by
I'm attempting to create my first real C# application - a small pet project

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.