This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
In my FBN impementation, I decided to extend the AbstractTableModel instead of using the DefaulTableModel because I wanted each row in my Table model to be maintained in a flight data object, holding data related to a flight. So my extended table model maintains a vector of objects, where each object is one row in my table. I implemented the getValueAt( int row, int col) call the proper get method on the row'th element in my vector of objects. I also implemented the getColumnName( int col ) to return a name for each column in my table. Now the problem... The column headers do not display. Where does the JTable get the names to display in the column headers? Do I have to provide those names to the JTable or should it get them from my table model? Thanks, Eric
Now the problem... The column headers do not display. Where does the JTable get the names to display in the column headers? Do I have to provide those names to the JTable or should it get them from my table model?
Try wrapping the JTable in a JScrollPane and the headers should appear. Also, nix the vector for one of the newer Collection classes like ArrayList. Hope this helps, Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Joined: May 21, 2002
That certainly dideley did it! Thanks Michael. Eric