Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable AUTO_RESIZE_OFF and extra column

 
Mikko Kohtamäki
Ranch Hand
Posts: 112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :)

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic