JSplitPane splitting 50% precisely

后端 未结 4 932
悲&欢浪女
悲&欢浪女 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:06

    The solutions here do not take into account the case where the user moves the divider (i.e. a variable divider location). A complete example that takes this into account is available here:

    How do you get JSplitPane to keep the same proportional location if the user has moved the location of the divider

提交回复
热议问题