public void layoutContainer(Container c) { JButton leftButton = getLeftButtonFromSuper(); JButton rightButton = getRightButtonFromSuper(); JSplitPane splitPane = getSplitPaneFromSuper(); int orientation = getOrientationFromSuper(); int oneTouchSize = getOneTouchSizeFromSuper(); int oneTouchOffset = getOneTouchOffsetFromSuper(); Insets insets = getInsets(); // This layout differs from the one used in BasicSplitPaneDivider. // It does not center justify the oneTouchExpadable buttons. // This was necessary in order to meet the spec of the Metal // splitpane divider. if (leftButton != null && rightButton != null && c == FlatSplitPaneDivider.this) { if (splitPane.isOneTouchExpandable()) { if (orientation == JSplitPane.VERTICAL_SPLIT) { int extraY = (insets != null) ? insets.top : 0; int blockSize = getDividerSize(); if (insets != null) { blockSize -= (insets.top + insets.bottom); } extraY = 2; blockSize = Math.min(blockSize, oneTouchSize); leftButton.setBounds(oneTouchOffset, extraY, blockSize * 2, blockSize); rightButton.setBounds( oneTouchOffset + oneTouchSize * 2, extraY, blockSize * 2, blockSize); } else { int blockSize = getDividerSize(); int extraX = (insets != null) ? insets.left : 0; if (insets != null) { blockSize -= (insets.left + insets.right); } blockSize = Math.min(blockSize, oneTouchSize); leftButton.setBounds(extraX, oneTouchOffset, blockSize, blockSize * 2); rightButton.setBounds( extraX, oneTouchOffset + oneTouchSize * 2, blockSize, blockSize * 2); } } else { leftButton.setBounds(-5, -5, 1, 1); rightButton.setBounds(-5, -5, 1, 1); } } }