File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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 :)

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable AUTO_RESIZE_OFF and extra column
 
Similar Threads
JTable ........
Select All checkbox in Jtable
JTable set column data type
jtable: column header click
Related JTable Header