Mariusz
Mariusz

Reputation: 1875

JTable - multi-type column

I'm trying to make a simple properties window using JTable with two columns: Property and Value. I want 'Value' column to be either textedit or checkbox. How to achive it?

Thanks in advance

Upvotes: 0

Views: 120

Answers (1)

Heisenbug
Heisenbug

Reputation: 39204

You should implement your custom TableCellRenderer and TableCellEditor.

Then retrieve the TableColumn you need to customize and set your class where you implemented those interfaces.

TableColumn column = table.getColumnModel().getColumn(vColIndex);
column.setCellRenderer(new YourCustomCellRenderer());
column.setCellEditor(new YourCustomCellEditor());

Upvotes: 3

Related Questions