Different Renderer type per row in same column of JTable?

R

RobE

Hello,

I want to provide a field value editing capability using a JTable. I
want to display different renderers on each row of the Value column
depending on the field type ie if date render date chooser, if
multiple strings, render combobox etc. Is that possible to do?

Thanks in advance,
Rob.
 
R

Roedy Green

I want to provide a field value editing capability using a JTable. I
want to display different renderers on each row of the Value column
depending on the field type ie if date render date chooser, if
multiple strings, render combobox etc. Is that possible to do?

Renderers are installed per column. You need to write a Renderer that
looks at the row number and invokes the appropriate method.
 
?

=?ISO-8859-1?Q?J=F6rg_Marti?=

Hello
Take a look at http://manning.spindoczine.com/sbe/ chapter 18. Tables
ore
try somthing like this:

public class MyTable extends JTable {
public TableCellEditor getCellEditor(int aRow, int aColumn) {
if (......) {
return new DefaultCellEditor(new JComboBox(....));

}
if (......) {
return DefaultCellEditor(new .....
}
if (......) {
return super.getCellEditor(aRow,aColumn);
}
}

Jörg Marti
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top