BorderLayout: Nested CENTER Panel Grows But does Not Resize Outer Panel

前端 未结 1 1877
轮回少年
轮回少年 2021-01-24 16:56

I have a main JPanel which implements Scrollable and uses a BorderLayout. It contains one NORTH readonly JEditorPane, one CENTER JPanel with a FlowLayout whereby JButtons are a

1条回答
  •  滥情空心
    2021-01-24 17:35

    The problem is that the FlowLayout does not recalculate the preferred size when buttons are wrapped to the next row.

    You should be able to use the WrapLayout.

    WrapLayout extends FlowLayout and sets the proper preferred size when components wrap to a new row.

    0 讨论(0)
提交回复
热议问题