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.
The moose likes Swing / AWT / SWT and the fly likes JTable AUTO_RESIZE_OFF and extra column Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable AUTO_RESIZE_OFF and extra column" Watch "JTable AUTO_RESIZE_OFF and extra column" New topic
Author

JTable AUTO_RESIZE_OFF and extra column

Mikko Kohtamäki
Ranch Hand

Joined: Dec 13, 2008
Posts: 112
Hi, had problem to fill the extra space of JTable when there are too few columns to fill the preferredScrollableViewportSize, when JTable's autoResizeMode is AUTO_RESIZE_OFF.

This example overrides configureEnclosingScrollPane() in JTable to rebuild whole new view.

JTableViewFiller listens LinkTable when it resizes to get new width for extra JTableHeader.

JTableViewFiller delegates LinkTable's Scrollable interface methods.

RendererPanel has a preferred size set that is updated, it has CellRendererPane which paints the extra JTable to extra space.

getHeaderViewFiller() is where you get the header view for JScrollPane.


I have a table that has visible row count, rows that dont exist in model, etc. Here I tried to do short and working example for JTable.
PROBLEM is that when I resize the column to right of actual table and if JScrollPane has defaults in ScrollBarPolicy (AS_NEEDED),
then horizontal scroll bar is FLICKERING... how to remove this behaviour or is this good at all ???

Will I set ScrollBarPolicies temporarely when resizing and table's width is less than preferredScrollableViewportSize.width

Try it, many thanks :)

 
Don't get me started about those stupid light bulbs.
 
subject: JTable AUTO_RESIZE_OFF and extra column