int width = getWidth();
int height = getHeight();
SplitPane splitPane = (SplitPane)getComponent();
int splitLocation = splitPane.getSplitLocation();
Component leftComponent = splitPane.getTopLeftComponent();
Component rightComponent = splitPane.getBottomRightComponent();
int rightStart = splitLocation + splitterThickness;
if (splitPane.getOrientation() == Orientation.HORIZONTAL) {
splitter.setLocation(splitLocation, 0);
splitter.setSize(splitterThickness, height);
if (leftComponent != null) {
leftComponent.setLocation(0, 0);
leftComponent.setSize(splitLocation, height);
}
if (rightComponent != null) {
rightComponent.setLocation(rightStart, 0);
rightComponent.setSize(Math.max(width - rightStart, 0), height);
}
} else {
splitter.setLocation(0, splitLocation);
splitter.setSize(width, splitterThickness);
if (leftComponent != null) {
leftComponent.setLocation(0, 0);
leftComponent.setSize(width, splitLocation);
}
if (rightComponent != null) {
rightComponent.setLocation(0, rightStart);
rightComponent.setSize(width, Math.max(height - rightStart, 0));
}
}
}