Skip to content

Commit f8c99d5

Browse files
committed
ScrollPaneLayout fix
1 parent 14445a8 commit f8c99d5

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

sources/net.sf.j2s.java.core/src/java/awt/LayoutManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ public interface LayoutManager {
6464
/**
6565
* Calculates the preferred size dimensions for the specified
6666
* container, given the components it contains.
67-
* @param parent the container to be laid out
67+
* @param container the container to be laid out
6868
*
6969
* @see #minimumLayoutSize
7070
*/
71-
Dimension preferredLayoutSize(Container parent);
71+
Dimension preferredLayoutSize(Container container);
7272

7373
/**
7474
* Calculates the minimum size dimensions for the specified

sources/net.sf.j2s.java.core/src/javax/swing/ScrollPaneLayout.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -461,24 +461,25 @@ else if (key.equals(UPPER_RIGHT_CORNER)) {
461461
* <p>Note that the rowHeader is calculated as part of the preferred width
462462
* and the colHeader is calculated as part of the preferred size.
463463
*
464-
* @param parent the <code>Container</code> that will be laid out
464+
* @param container the <code>Container</code> that will be laid out
465465
* @return a <code>Dimension</code> object specifying the preferred size of the
466466
* viewport and any scrollbars
467467
* @see ViewportLayout
468468
* @see LayoutManager
469469
*/
470-
public Dimension preferredLayoutSize(Container parent)
470+
public Dimension preferredLayoutSize(Container container)
471471
{
472472
/* Sync the (now obsolete) policy fields with the
473473
* JScrollPane.
474474
*/
475-
JScrollPane scrollPane = (JScrollPane)parent;
475+
JScrollPane scrollPane = (JScrollPane)container;
476476
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
477477
hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
478478

479479
// BH -- this was a problem when the scrollpane was in a split pane in SetXMLControlElement test OSP
480-
Insets insets = new Insets(0,0,0,0);//
481-
// parent.getInsets(); because these are interior?
480+
Insets insets = //new Insets(0,0,0,0);//
481+
container.getInsets();
482+
//because these are interior?
482483
int prefWidth = insets.left + insets.right;
483484
int prefHeight = insets.top + insets.bottom;
484485

@@ -512,7 +513,7 @@ public Dimension preferredLayoutSize(Container parent)
512513

513514
Border viewportBorder = scrollPane.getViewportBorder();
514515
if (viewportBorder != null) {
515-
Insets vpbInsets = viewportBorder.getBorderInsets(parent);
516+
Insets vpbInsets = viewportBorder.getBorderInsets(container);
516517
prefWidth += vpbInsets.left + vpbInsets.right;
517518
prefHeight += vpbInsets.top + vpbInsets.bottom;
518519
}

0 commit comments

Comments
 (0)