Java 调整大小 window 包括 JSplitPane :固定大小的面板?
Java resizing window including a JSplitPane : fixed size panel?
我的软件中有一个 JSplitpane,里面有两个 JPanel,我希望分隔线的高度随着屏幕大小的调整而调整
这是我调整大小时发生的情况:
我到处找这个,我知道它一定很容易修复,但我找不到。
所需代码:
splitPane.setResizeWeight(1);
解释:
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). Specifically, the left/top component gets (weight * diff) extra space
and the right/bottom component gets (1 - weight) * diff extra space.
我的软件中有一个 JSplitpane,里面有两个 JPanel,我希望分隔线的高度随着屏幕大小的调整而调整
这是我调整大小时发生的情况:
我到处找这个,我知道它一定很容易修复,但我找不到。
所需代码:
splitPane.setResizeWeight(1);
解释:
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). Specifically, the left/top component gets (weight * diff) extra space and the right/bottom component gets (1 - weight) * diff extra space.