JSplitPane SetDividerLocation问题 [英] JSplitPane SetDividerLocation Problem
问题描述
我有一个JSplitPane,在显示时应将窗格拆分50%.
I have a JSplitPane which when shown should split the pane by 50%.
现在,将setDividerLocation的参数设为0.5(如建议的那样),Java似乎将其视为普通数字而不是百分比.如图所示,分隔符几乎没有在窗格的中间,而是在左窗格的开始处(窗格是垂直拆分的). 有什么解决方法吗?
Now on giving an argument of 0.5 (as suggested) to setDividerLocation, Java seems to treat it as a normal number instead of a percentage. As in, the divider, instead of going to the middle of the pane, is almost at the start of the left pane (the pane is vertically split). Any work arounds?
推荐答案
我错过了什么吗?这个问题似乎有很多令人费解的答案...但是我认为简单的setResizeWeight(0.5)可以解决问题...
Am I missing something? There seem to be a lot of rather convoluted answers to this question... but I think a simple setResizeWeight(0.5) would solve the issue ... it's described in the SplitPane Tutorial
这篇关于JSplitPane SetDividerLocation问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!