Reputation:
GirdLayout
makes a bunch of components equal in size. That means that the biggest sized component will define the size for all components. Is it possible to make each component's size based on their inner-components instead?
EDIT: If it's not possible, how could I get the same effect as a GridLayout
but with each component's size based on their inner-components.
Upvotes: 2
Views: 6062
Reputation: 346465
No, you'll have to use a different layout manager for that. GroupLayout
would be an option.
Upvotes: 5
Reputation: 8839
It's not possible, but you can use nested components in each cell. For example, if you don't want a JButton
to expand to the size of a cell, add it to a Jpanel
, then add the JPanel
to the cell.
Upvotes: 2