0

I have a JTable and it has 35 columns so I cannot clearly get a view of all columns on this table. It looks like below.

enter image description here

Then I decided to get all columns into first column as rows. But I haven't any clear idea how to do this using table properties.

How to set all columns as rows in first column on a JTable?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Terance Wijesuriya
  • 1,928
  • 9
  • 31
  • 61
  • 1
    It's not really something that `JTable`'s designed for, you're going to have to supply your own "row header", maybe someting like [this](http://stackoverflow.com/questions/26248084/how-to-display-row-header-on-jtable-instead-of-column-header/26248635#26248635)... – MadProgrammer Feb 16 '16 at 09:04
  • @MadProgrammer :- How could I use your advice for a JTable from NetBeans Palette ? – Terance Wijesuriya Feb 16 '16 at 09:08
  • 2
    You can't, the problem you have is far too complex to be solved through "form editors" alone, you will need to get your hands dirty. Now, because `TableWithRowHeader` extends `JTable`, it means you can drag it onto the form – MadProgrammer Feb 16 '16 at 09:10
  • @MadProgrammer : In your example , you didn't feed any data to the table . But I use a for loop to feed some data . – Terance Wijesuriya Feb 16 '16 at 10:34
  • @MadProgrammer :- So , how do you change your example for feed data to the table ? – Terance Wijesuriya Feb 16 '16 at 10:37
  • 3
    Use a `TableModel` like you should, see [How to Use Tables](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html) for more details – MadProgrammer Feb 16 '16 at 10:40

0 Answers0