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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:04:57+00:00 2026-05-11T04:04:57+00:00

I want to put individual JComboBoxes into each cells of a JTable. ie. The

  • 0

I want to put individual JComboBoxes into each cells of a JTable. ie. The JComboBox content is not identical for each cell.

I basically would like to be able to just call the following code to add a row of JComboBox into the JTable. Anyone has any idea? Thanks

JComboBox cb1 = new JComboBox(...); JComboBox cb2 = new JComboBox(...); model.addRow(new Object[] {'Row name', cb1, cb2} );  JComboBox cb3 = new JComboBox(...); JComboBox cb4 = new JComboBox(...); model.addRow(new Object[] {'Row name 2', cb3, cb4} ); 

The closest example code I can find is as follows. But it is for where JComboBox content is identical for the individual column. Not the solution I need.

TableColumn col = table.getColumnModel().getColumn(vColIndex); col.setCellEditor(new MyComboBoxEditor(values)); 

where

public class MyComboBoxEditor extends DefaultCellEditor {     public MyComboBoxEditor(String[] items) {         super(new JComboBox(items));     } } 
  • 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. 2026-05-11T04:04:57+00:00Added an answer on May 11, 2026 at 4:04 am

    The easiest way is to implement your own TableModel

    public class MyModel extends AbstractTableModel {     List rows;      public int getRowCount() {         return rows.size();     }      public int getColumnCount() {          return 4;     }      public Object getValueAt(int row, int column) {         return rows.get(row).getCol(col);  //assuming your row 'Object' has a getCol()     }      public Class<?> getColumnClass(int col) {         return Boolean.class;     }      public void setValueAt(Object aValue, int rowIndex, int columnIndex) {         rows.get(rowIndex).getCol(columnIndex).setValue(aValue);     }  } 

    Load this into you JTable. If you haven’t replaced the default cell renderer for Boolean’s, all you cells will be rendered as check boxes thanks to you implementation of getColumnClass(). All user input to these check boxes is collected with our setValueAt().

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

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I found this by doing a search on 'Hibernate fixtures'… May 11, 2026 at 2:00 pm
  • added an answer All these methods are very different in terms of what… May 11, 2026 at 2:00 pm
  • added an answer You could try by replacing: frame.setFileName(selectedFile.getName()); with frame.setTitle(selectedFile.getName()); I don't… May 11, 2026 at 2:00 pm

Related Questions

I want to put a copyright notice in the footer of a web site,
I want to put random output from my result set (about 1.5 mil rows)
I want to put my dependent files in the app directory. I seem to
I want to put some common information in my MasterPage to be shown on
I want to create some heat-map style tiles to overlay over our base maps
I have a form with 3 panels, the panels are created because at certain
I've had several clients ask this, and I've never been able to get or
My problem is that I want a grid that is populated with a set

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.