I am putting a JTable into a JScrollPane
But When I set JTable Auto Resizeable, then it won’t have horizontal scroll bar.
if I set AUTO_RESIZE_OFF, then the Jtable won’t fill the width of its container when the column width is not big enough.
So how can I do this:
- when the table is not wide enough, expand to fill its container width
- when the table is wide enough, make it scrollable.
Thanks
You need to customize the behaviour of the Scrollable interface.
The above code basically sizes the component at its preferred size or the viewport size, whichever is greater.