views:

129

answers:

1

I have a 2D array of objects which needs to be displayed in a table through a table model class which extends a DefaultTableModel. In addition to the columns needed to accommodate the data included in this array, I would like to add an extra column with radiobuttons, in order to enable the user to make a selection. As table model accepts only arrays of objects or vectors, how should I add radio buttons?

+1  A: 

By default, JTable infers how to render and edit entries based on the entry's class, as discussed in the tutorial article Editors and Renderers. In this example, a checkbox allows multiple selections in a column. Substituting a radio button and using a ButtonGroup would accommodate a unique selection.

trashgod