JSplitPane splitting 50% precisely

后端 未结 4 934
悲&欢浪女
悲&欢浪女 2021-02-03 23:24

In Swing, what\'s the best way to make the JSplitPane to split two jpanels with 50% size each.

It looks like if I don\'t set preferred sizes on the panels it always make

4条回答
  •  你的背包
    2021-02-04 00:02

    Use

    setResizeWeight(.5d);

    [...] A value of 0, the default, indicates the right/bottom component gets all the extra space (the left/top component acts fixed), where as a value of 1 specifies the left/top component gets all the extra space (the right/bottom component acts fixed). [...]

提交回复
热议问题