Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a Java Swing JTable with header as first column, not as first row?

I am using Java 6.0 + Swing + JTable.

Normally, JTable renders the header as the first row. (Left image)

However, I would like to render the header as the first column. (Right image)

I don't think this is a simple flag in JTable.

Can you please recommend an approach or existing widget library?

I assume I need to override the paint() methods for JTableHeader and JTable.

Thanks

Table with header as first row Table with header as first column

like image 867
kevinarpe Avatar asked Feb 20 '26 08:02

kevinarpe


1 Answers

Oops, never mind you want a transposed TableModel, not just row headers.

See http://tips4java.wordpress.com/2008/11/18/row-number-table/

like image 121
Walter Laan Avatar answered Feb 22 '26 21:02

Walter Laan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!