In article <
JTable-201...@ram.dialup.fu-berlin.de>,
r...@zedat.fu-berlin.de (Stefan Ram) wrote:
>
r...@zedat.fu-berlin.de (Stefan Ram) writes:
>> Is there a way to have horizontal columns with a JTable (and
>> vertical rows)? (Where a column is defined as that vector
>> whose components all have the same type.)
>>
>> Instead of
>>
>> Name Value
>> 01 A 1.2
>> 02 B 2.3
>> 03 C 0.9
>>
>> , I want the same table model to be rendered as
>>
>> 01 02 03
>> Name A B C
>> Value 1.2 2.3 0.9
JTable displays what the TableModel returns for getValueAt();
you will have to transpose the model.
> Equivalent question: I want to set a row type for all the values
> in a row, while values in a column might have mixed types.
You can recycle the default cell renderer(s), as shown here:
<
http://stackoverflow.com/a/7701420/230513>
> The standard solution would be to write a new TableUI for this
> I guess, that renders columns horizontally. I'd like to know
> if there is a shortcut.
You can recycle the default header renderer, as shown here:
<
http://stackoverflow.com/a/8005006/230513>
The result is still a JTable, i.e. it has a TableColumnModel,
not a notional RowColumnModel.
--
John B. Matthews
trashgod at gmail dot com
<
http://sites.google.com/site/drjohnbmatthews>