File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Problems with JTable.  Need help!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problems with JTable.  Need help!!" Watch "Problems with JTable.  Need help!!" New topic

Problems with JTable. Need help!!

Raul Quintero

Joined: Feb 18, 2000
Posts: 7
I have a JTable that is created with my own table renderer. It sits in a panel, which sits in another panel. This parent panel controls all the actions done with the table and trees and buttons etc. Within the table, I "hide" a column by setting the min/max/perferred width to 0. The problem I am having is: When a user clicks on an object in the tree, the table is supposed to display that objects information. The first time around, the table is displayed with all columns the same width (this is not supposed to happen), then the next time a user clicks on another object, the table displays the info with the correct widths but.....
1. the column widths do not maintain the widths that the user wants. i.e. when a column is dragged to be larger in width, it is lost with the next table change
2. The table background doesn't seem to change with the dimensions of the table when an object is choosen from the tree. What I mean by this is: the first time around the table's total width is say 500 (all column widths combined). The next time the table is displayed, it's total width is 550, what it should be, but the last column is only rendered on the screen to be 500. So, the column headers are 550 in total width, but the columns themselves only paint to 500. Only when the user drags the last column's border to resize it will the table column itself repait to fit the table.
3. After navigating for a while, clicking on multiple objects, displaying multiple versions of the table, I "lose" the last column. It disappears and the only way to get it back is to start the application all over again.
I know this is pretty complicated, and was hard for me just to try to write this down and explain what the problems are.

I agree. Here's the link:
subject: Problems with JTable. Need help!!
It's not a secret anymore!