I have configured my layout like that:
panel.add(addButtons(), "wrap");
panel.add(showTable(), "growx, wrap");
So at first I am adding a button group and then I would like to grow my table as large as it can and then wrap the next component in the next "line".
However, my gui looks like that:
Here you clearly cannot see any values from the table. Therefore, how to grow the table so that each value can be seen?
I appreciate your answer!
You can use
javax.swing.table.TableColumn;
As you want to widen all columns you can use loop :
As I've said in my comment, I don't think your problem is about columns (preferred | min | max) sizes but the default behavior of your layout manager: MigLayout. As stated in this answer by default rows in
MigLayout
doesn't fill all available width but just the necessary to display the longest row (based on components width). You can see this fact if you enable "debug" feature when you instantiate your layout:As I understand your question you need a combination of both
growx
andfillx
constraint. The first one is a component constraint and the other one is a layout constraint.That being said, pelase consider the following progression.
1. Adding scroll pane without "growx" constraint
Snippet
Screenshot
2. Adding scroll pane with "growx" constraint
Snippet
Screenshot
3. Adding scroll pane with "growx" and "fillx" contraints
Snippet
Screenshot