Benjamim Rodrigo
Benjamim Rodrigo

Reputation: 26

CheckBox Selection in JTable

I want, in a JTable, has a column that when it is clicked, a JPanel to appear with the names of all the columns, and it can select (with JCheckBox) which we want to continue in the JTable. It would be a column with "#".

Upvotes: 1

Views: 151

Answers (2)

camickr
camickr

Reputation: 324197

Not exactly what you asked for but maybe you can use the Table Column Manager.

The Table Column Manager manages which columns are visible in the table. You invoke the Table Column Manager by right clicking on any column in the column header. You are presented with a popup menu that uses check boxes to hide/show columns.

Upvotes: 0

Philipp Lengauer
Philipp Lengauer

Reputation: 1959

Just create such a column in your data model implementation, with a custom artificial data object. Then register an editor (setDefaultEditor) in the jtable to show a checkbox or open a dialog with a checkbox. based on the user selection you may then alter your model (add or remove columns) and fire an according changed event.

Upvotes: 1

Related Questions