It's actually an question about this. How do I resize this now? I used this, I was able to resize my JPanel, but I can't find how to resize the table or scrollpane. I have 10 columns and the table just stays the same size.
Thanks in advance
It's actually an question about this. How do I resize this now? I used this, I was able to resize my JPanel, but I can't find how to resize the table or scrollpane. I have 10 columns and the table just stays the same size.
Thanks in advance
I was able to resize my JPanel, but I can't find how to resize the table or scrollpane.
The problem is that the JPanel uses a FlowLayout. A FlowLayout will respect the preferred size of any component added to the panel. So in the example code the table is displayed at its default preferred size.
A couple of solutions:
getPreferredScrollableViewportSize(...)
method of the JTable
. This will override the default preferred size of the table. The table may grow/shrink depending of the layout manager used.