Hi all, Here is my problem. When you write the following code : MyTableModel mymodel = new MyTableModel(); JTable table = new JTable(mymodel); JScrollPane scroll = new JScrollPane(table); the scroll pane gets the table header (Table Column Model) add displays it automatically at the TOP of the scroll pane,orientation is TOP-LEFT --> TOP-RIGHT. This is fine for most cases were a JTable is used. But in some cases were for instance, you want to display data side by side (for comparison, etc ..) it would be usefull to change this default behavior so that the Table header is displayed as Row-Header (TOP-LEFT --> BOTTOM-LEFT) and create a header that will be displayed in the 'normal' place of the header.(The model should understand the new (row,column) requests). Example : Here is a Table : <CODE> _____________________________________________________ |Surname | First Name | DOB | etc. | ppp | ppp | ppp | ______________________________________________________ xxxx | xxxx | xxx | xxxx | xxx | xxx | xxx | ______________________________________________________ ............. ______________________________________________________ xxxx | xxx | xxx | xxx | xxx | XX | XXx | ______________________________________________________ </CODE> Now, supposing I want to display Parent and Child data , the table would look like : <CODE> <PRE> _____________________________________ | Parent | Child | _____________________________________ Surname | xxxx | xxxx _____________________________________ First name | xxx | xxxxx _____________________________________ DOB | xxx | xxxx ______________________________________ etc. | xx | xxx _____________________________________ ppp | xxx | xxx _____________________________________ ppp | xxx | xxx _____________________________________ ppp | xxx | xxx _____________________________________ </PRE> </CODE> I would like to use the same TableModel(it is still the same data). My question is, How can I get the Table Header to display (as in the figure). I don't have a proble creating row-header Jtables. The only solution I have at the moment is trying to translation (row, column) between the 2 tables, but I don't think it is the best way ! Any ideas ? Thanks. [ September 25, 2003: Message edited by: raphael Bereh ] [ September 25, 2003: Message edited by: raphael Bereh ] Christ UBB s*** Just give us some nice HTML - (<PRE> ) . My Table looks nothing like one ! [ September 25, 2003: Message edited by: raphael Bereh ]
Please refrian from using the word URGENT in your post subject. We treat every post on Javaranch with equal importance and using such words will not help your questions get answered any quicker. It's a bit annoying...
Enjoy the full beauty of the english language. Embedded in this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth