Skip to content

Commit df9cd56

Browse files
hansonrhansonr
authored andcommitted
prefSize default to minimum only if w=0 and h=0
1 parent 5b5b1ea commit df9cd56

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2385,10 +2385,13 @@ protected Dimension prefSizeComp() {
23852385
Dimension dim = prefSize;
23862386
if (dim == null || !(isPreferredSizeSet() || isValid())) {
23872387
// synchronized (getTreeLock()) {
2388+
2389+
// SwingJS TODO: it is not clear that we should deliver getMinimumSize here.
2390+
//
23882391
prefSize = // (
23892392
// peer != null) ?
23902393
// peer.preferredSize() :
2391-
getMinimumSize();
2394+
(width == 0 && height == 0 ? getMinimumSize() : new Dimension(width, height));
23922395
dim = prefSize;
23932396
}
23942397
// }

0 commit comments

Comments
 (0)