| Author |
JTable header doesn't show
|
Kate Zoy
Ranch Hand
Joined: Feb 11, 2004
Posts: 33
|
|
I got a JTable which is supposed to have headers, but they don't show! I have: public String getColumnName( int c ){return headers[c];} where headers in an array of strings. This function is in my custom model which extends abstractTableModel. I've done this in another part of my code and it works. Why it doesn't work this time is beyond me! Have any ideas? Thanks!
|
 |
maggie woo
Ranch Hand
Joined: Dec 18, 2003
Posts: 35
|
|
Is your problem related to getting a valid value out of the headers array, or that the JTable component in a container is not displaying the headers on the table? If the first, you may need to post more of your code. If the second, try putting the JTable in a JScrollPane.
|
 |
Vishal Methi
Ranch Hand
Joined: Jan 14, 2004
Posts: 52
|
|
Hi Dear, The solution of ur problem is that just u have the the tablemodel on JTable and the syntax is jtable1.setModel(customTableModel); note . customTableModel is the object of defaulttablemodle or any table model..... Is it ur solution. Vishal
|
 |
Kate Zoy
Ranch Hand
Joined: Feb 11, 2004
Posts: 33
|
|
|
Well, turns out I just forgot to put it in a JScrollPane! That is the only line of code different to my other JTables and I didn't even notice! Thanks so much maggie!
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: JTable header doesn't show
|
|
|