Is it possible to make GridLayout's components not equal in size?
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 the开发者_C百科ir 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.
No, you'll have to use a different layout manager for that. GroupLayout
would be an option.
No, all cells are equal by design.
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.
Maybe a GridBagLayout is what you need.
精彩评论