The location of a divider is measured in pixels from either the left edge (in the case of a horizontal split pane) or the top edge (in the case of a vertical split pane).

There are two ways to set the location of the divider. The first is to specify an absolute location based on the distance in pixels from the left or top edge. The second is to specify a proportional location based on the distance from the left or top edge. For example, a proportional location of 0 sets the divider at the left or top edge. A proportional location of 1 sets the divider at the right or bottom edge. A proportional location of .5 sets the divider at the center.

    // Create a left-right split pane
JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent); // Get current location; result is number of pixels from the left edge
int loc = pane.getDividerLocation(); // Set a new location using an absolution location; center the divider
loc = (int)((pane.getBounds().getWidth()-pane.getDividerSize())/2);
pane.setDividerLocation(loc); double propLoc = .5D;
// Set a proportional location
pane.setDividerLocation(propLoc);
Related Examples

最新文章

  1. Go build constraints
  2. js中用tagname和id获取元素的3种方法
  3. [LeetCode] 452 Minimum Number of Arrows to Burst Balloons
  4. Scala类基础
  5. Twitter API升级至1.1
  6. textile
  7. 第二章TP-Link 703N OpenWrt刷回原厂固件
  8. SQL语句优化方法
  9. Cocos2d-x实现粒子效果的三种方式
  10. Coreseek:indexer crashed神秘
  11. mysql server的安装和配置
  12. 寻找与疾病相关的SNP位点——R语言从SNPedia批量提取搜索数据
  13. Python2.x的编码问题
  14. java的<<左移,>>右移,>>>无符号右移
  15. 移动端开发调试工具神器--Weinre使用方法
  16. window.opener和window.open
  17. exec sp_spaceused如何只返回一个结果集(转载)
  18. LaTeX 对齐问题
  19. python 回溯法 子集树模板 系列 —— 11、全排列
  20. git-采集编码搜索

热门文章

  1. 把虚拟教练带回家,「EuMotus」想用AI实现高精度运动反馈系统
  2. iOS开发-Tom猫
  3. 【Socket】linux网络扫描程序开发
  4. 12.22日wagas学习笔记
  5. 将本地代码同步到远程github上
  6. TortoiseSVN checkout 之后图标(绿色勾之类的)没有显示出来的问题
  7. C#学习笔记(15)——c#接口
  8. Android ListView的使用(三)
  9. 如何通过Dreamweaver批量对整个站点或目录进行代码搜索或部分全部替换
  10. 减少存储过程封装业务逻辑-web开发与传统软件开发的思维模式不同