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

e826. 获得和设置JSplitPane分开的位置的更多相关文章

  1. matplotlib之设置极坐标起点的位置

    #!/usr/bin/env python3 #-*- coding:utf-8 -*- ############################ #File Name: polar.py #Auth ...

  2. Java基础 awt Frame 设置窗体的大小 位置 可见性

        JDK :OpenJDK-11      OS :CentOS 7.6.1810      IDE :Eclipse 2019‑03 typesetting :Markdown   code ...

  3. Mac 可设置环境变量的位置、查看和添加PATH环境变量

    Mac 启动加载文件位置(可设置环境变量) ------------------------------------------------------- (1)首先要知道你使用的Mac OS X是什 ...

  4. 3ds max画曲线 设置摄像机的起始位置

    参考 http://www.3dmax8.com/3dmax/2013/0916/5661.html 如果想创建曲线段,可以在单击下一个点时按住鼠标不放,继续拖曳,再拖到另一个点上,单击鼠标右键,即可 ...

  5. Mac可设置环境变量的位置、查看和添加PATH环境变量

    Mac 启动加载文件位置(可设置环境变量) 首先要知道你使用的 Mac OS X 是什么样的 Shell,使用命令 echo $SHELL 如果输出的是:csh 或者是 tcsh,那么你用的就是 C ...

  6. PL/SQL常用设置 可看引用位置更清晰直观 引自:http://blog.csdn.net/xiaoqforever/article/details/27695569

    引自:http://blog.csdn.net/xiaoqforever/article/details/27695569 1,登录后默认自动选中My Objects 默认情况下,PLSQL Deve ...

  7. (转)background-position—CSS设置背景图片的位置

    background-position :在 CSS 中通过 background-position 属性可以调整背景图片的位置.因为在默认情况下背景图片都是从设置了 background-posit ...

  8. unity3d在菜单栏,一键设置Player setting及自动打包并设置apk的存储位置

    项目进行中,领导要求能够进行一键设置Player settings及自动打包并设置apk的位置,所以自己就上网搜索了很多大神的文章.最后是完成了领导需要的功能,在这里记录并分享一下(此项指针对安卓ap ...

  9. 关于CKEditor4.5.6的使用,自定义toolbar配置,上传图片案例(SpringMVC+MyBatis案例),自定义行高,去编辑器的中内容,将编辑器中内容设置到指定的位置等

     关于CKEditor的一个配置整理,改文件为config.js: 文件内容如下: /** * @license Copyright (c) 2003-2016, CKSource - Frede ...

随机推荐

  1. Word中MathType公式与LaTeX公式的转换

    1. 对Word文档中用MathType输入的公式,在word中,选中mathtype公式,按住“Alt+\”键,可以将MathType公式转换成Latex格式. 2. 同样,将Latex格式的公式代 ...

  2. Docker 入门 --- 命令总结

    Docker命令总结 前言 命令来自于官网的get-started教程,放在这里自用 part-1 ## List Docker CLI commands docker docker containe ...

  3. js随机生成一个数组中的随机字符串以及更新验证码

    随机生成m,n范围的值得公式: Math.random()*(n-m)+m: 改正公式:Math.random()*(n+1-m)+m // 生成随机字符串function randomMixed(n ...

  4. 【linux】提醒"libc.so.6: version `GLIBC_2.14' not found"系统的glibc版本太低

    原文链接:http://www.myexception.cn/linux-unix/1622052.html [linux]提示"libc.so.6: version `GLIBC_2.14 ...

  5. 多 LDAP 目录服务器的 FileNet P8 系统介绍和配置实例

    摘抄笔记:http://www.ibm.com/developerworks/cn/data/library/techarticle/dm-1312multipldap/ 多 LDAP 目录服务器的 ...

  6. Android Retrofit2 网路编程

    Android里面本身有OKHttp,不过不是很好用,这里就用Retrofit2,简单好用. 首先,需要加入网络权限: <uses-permission android:name="a ...

  7. [转]mysql如何利用Navicat 导出和导入数据库

    MySql是我们经常用到的数据,无论是开发人员用来练习,还是小型私服游戏服务器,或者是个人软件使用,都十分方便.对于做一些个人辅助软件,选择mysql数据库是个明智的选择,有一个好的工具更是事半功倍, ...

  8. Visual Studio的NuGet包管理器无法加载

    由于网络原因,虽然地址http://www.nuget.org和https://www.nuget.org/api/v2/在浏览器可以正常打开,但是在VS中使用默认的NuGet程序包源经常加载不出来, ...

  9. where子查询

    限定查询(WHERE子句) 之前的查询是将一张表的全部记录查询出来,那么现在如果希望可以根据指定的条件查询的话,则必须指定限定查询. 格式: 的雇员的信息 l  使用“<>”完成 l  S ...

  10. PostgreSql 函数

    DECLARE curParkingTime TIMESTAMP ; curLeavingTime TIMESTAMP; parkingSpaceIndexCode VARCHAR[]; days I ...