404 |
*/ |
*/ |
405 |
protected void setComponentToSize(Component c, int size, int location, |
protected void setComponentToSize(Component c, int size, int location, |
406 |
Insets insets, Dimension containerSize) |
Insets insets, Dimension containerSize) |
407 |
{ |
{ |
408 |
int w = size; |
int w = size; |
409 |
int h = containerSize.height - insets.top - insets.bottom; |
int h = containerSize.height - insets.top - insets.bottom; |
410 |
int x = location; |
int x = location; |
637 |
int x = insets.left; |
int x = insets.left; |
638 |
int h = size; |
int h = size; |
639 |
int w = containerSize.width - insets.left - insets.right; |
int w = containerSize.width - insets.left - insets.right; |
|
|
|
640 |
c.setBounds(x, y, w, h); |
c.setBounds(x, y, w, h); |
641 |
} |
} |
642 |
|
|
816 |
int newSize = splitPane.getDividerSize(); |
int newSize = splitPane.getDividerSize(); |
817 |
int[] tmpSizes = layoutManager.getSizes(); |
int[] tmpSizes = layoutManager.getSizes(); |
818 |
dividerSize = tmpSizes[2]; |
dividerSize = tmpSizes[2]; |
819 |
Component left = splitPane.getLeftComponent(); |
int newSpace = newSize - tmpSizes[2]; |
|
Component right = splitPane.getRightComponent(); |
|
|
int newSpace = newSize - tmpSizes[2]; |
|
|
|
|
820 |
tmpSizes[2] = newSize; |
tmpSizes[2] = newSize; |
821 |
|
|
822 |
tmpSizes[0] += newSpace / 2; |
tmpSizes[0] += newSpace / 2; |
823 |
tmpSizes[1] += newSpace / 2; |
tmpSizes[1] += newSpace / 2; |
824 |
|
|
825 |
layoutManager.setSizes(tmpSizes); |
layoutManager.setSizes(tmpSizes); |
826 |
|
resetLayoutManager(); |
827 |
} |
} |
828 |
else if (e.getPropertyName().equals(JSplitPane.ORIENTATION_PROPERTY)) |
else if (e.getPropertyName().equals(JSplitPane.ORIENTATION_PROPERTY)) |
829 |
{ |
{ |
1298 |
*/ |
*/ |
1299 |
public void setDividerLocation(JSplitPane jc, int location) |
public void setDividerLocation(JSplitPane jc, int location) |
1300 |
{ |
{ |
1301 |
|
location = validLocation(location); |
1302 |
|
Container p = jc.getParent(); |
1303 |
|
if (getOrientation() == 0 && location > jc.getSize().height) |
1304 |
|
{ |
1305 |
|
Dimension leftPrefSize = jc.getLeftComponent().getPreferredSize(); |
1306 |
|
while (p != null) |
1307 |
|
{ |
1308 |
|
p.setSize(p.getWidth(), p.getHeight() + leftPrefSize.height); |
1309 |
|
p = p.getParent(); |
1310 |
|
} |
1311 |
|
} |
1312 |
|
else if (location > jc.getSize().width) |
1313 |
|
{ |
1314 |
|
|
1315 |
|
Dimension rightPrefSize = jc.getRightComponent().getPreferredSize(); |
1316 |
|
while (p != null) |
1317 |
|
{ |
1318 |
|
p.setSize(p.getWidth() + rightPrefSize.width, p.getHeight()); |
1319 |
|
p = p.getParent(); |
1320 |
|
} |
1321 |
|
} |
1322 |
|
|
1323 |
setLastDragLocation(getDividerLocation(splitPane)); |
setLastDragLocation(getDividerLocation(splitPane)); |
1324 |
splitPane.setLastDividerLocation(getDividerLocation(splitPane)); |
splitPane.setLastDividerLocation(getDividerLocation(splitPane)); |
1325 |
int[] tmpSizes = layoutManager.getSizes(); |
int[] tmpSizes = layoutManager.getSizes(); |
1327 |
- layoutManager.getInitialLocation(splitPane.getInsets()); |
- layoutManager.getInitialLocation(splitPane.getInsets()); |
1328 |
tmpSizes[1] = layoutManager.getAvailableSize(splitPane.getSize(), |
tmpSizes[1] = layoutManager.getAvailableSize(splitPane.getSize(), |
1329 |
splitPane.getInsets()) |
splitPane.getInsets()) |
1330 |
- tmpSizes[0] - tmpSizes[1]; |
- tmpSizes[0]; |
|
|
|
1331 |
layoutManager.setSizes(tmpSizes); |
layoutManager.setSizes(tmpSizes); |
1332 |
splitPane.revalidate(); |
splitPane.revalidate(); |
1333 |
splitPane.repaint(); |
splitPane.repaint(); |
1568 |
*/ |
*/ |
1569 |
private int validLocation(int location) |
private int validLocation(int location) |
1570 |
{ |
{ |
1571 |
if (location < getMinimumDividerLocation(splitPane)) |
int min = getMinimumDividerLocation(splitPane); |
1572 |
return getMinimumDividerLocation(splitPane); |
int max = getMaximumDividerLocation(splitPane); |
1573 |
if (location > getMaximumDividerLocation(splitPane)) |
if (min > 0 && location < min) |
1574 |
return getMaximumDividerLocation(splitPane); |
return min; |
1575 |
|
if (max > 0 && location > max) |
1576 |
|
return max; |
1577 |
return location; |
return location; |
1578 |
} |
} |
1579 |
} |
} |