Skip to content

Commit 0baae96

Browse files
hansonrhansonr
authored andcommitted
proper calls to preferredSize()
1 parent e706634 commit 0baae96

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,9 +1070,13 @@ protected void addImpl(Component comp, Object constraints, int index) {
10701070
addImplCont(comp, constraints, index);
10711071
}
10721072

1073+
@SuppressWarnings("unused")
10731074
protected void addImplCont(Component comp, Object constraints, int index) {
10741075
synchronized (getTreeLock()) {
1075-
1076+
1077+
if (/** @j2sNative comp.getWrap$ && !this.isWrapper$ || */ false) {
1078+
comp = ((A2SWrappedComponent) comp).getWrap$();
1079+
}
10761080
// SwingJS used for all add methods
10771081

10781082
/*
@@ -1246,8 +1250,15 @@ public void remove(int index) {
12461250
* @see #validate
12471251
* @see #remove(int)
12481252
*/
1249-
public void remove(Component comp) {
1253+
@SuppressWarnings("unused")
1254+
public void remove(Component comp) {
12501255
synchronized (getTreeLock()) {
1256+
1257+
if (/** @j2sNative comp.getWrap$ && !this.isWrapper$ || */ false) {
1258+
comp = ((A2SWrappedComponent) comp).getWrap$();
1259+
}
1260+
1261+
12511262
if (comp.parent == this) {
12521263
int index = component.indexOf(comp);
12531264
if (index >= 0) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ public Dimension getPreferredSize() {
14701470
public Dimension getPrefSizeJComp() {
14711471
Dimension size = (!isPreferredSizeSet() && ui != null ? ui
14721472
.getPreferredSize(this) : null);
1473-
return (size == null ? super.preferredSize() : size);
1473+
return (size == null ? preferredSize() : size);
14741474
}
14751475

14761476
/**

sources/net.sf.j2s.java.core/src/swingjs/a2s/A2SContainer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package swingjs.a2s;
22

3+
// Applet, Dialog, Frame
34
public interface A2SContainer {
45

56
public A2SListener getA2SListener();

0 commit comments

Comments
 (0)