Skip to content

Commit c66f0dd

Browse files
committed
various fixes
-adds AU.doubleLength(double[]) -fixes new int[2][3][] not initializing properly -J2S._j2sargs missing "_" -JSComponentUI incorrectly using Component.visible rather than Component.isVisible() -- difference with JPopupMenu
1 parent 64462b8 commit c66f0dd

File tree

12 files changed

+55
-22
lines changed

12 files changed

+55
-22
lines changed
682 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20230101211500
1+
20230112135435
682 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20230101211500
1+
20230112135435
403 Bytes
Binary file not shown.

sources/net.sf.j2s.java.core/src/javajs/util/AU.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,16 @@ public static Object doubleLength(Object array) {
8282
return arrayCopyObject(array, (array == null ? 16 : 2 * getLength(array)));
8383
}
8484

85+
86+
8587
public static String[] doubleLengthS(String[] array) {
8688
return arrayCopyS(array, (array == null ? 16 : 2 * array.length));
8789
}
8890

91+
public static double[] doubleLengthD(double[] array) {
92+
return arrayCopyD(array, (array == null ? 16 : 2 * array.length));
93+
}
94+
8995
public static float[] doubleLengthF(float[] array) {
9096
return arrayCopyF(array, (array == null ? 16 : 2 * array.length));
9197
}

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSComponentUI.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,8 +1319,10 @@ public void propertyChange(PropertyChangeEvent e) {
13191319
updatePropertyAncestor(false);
13201320
if (value == null)
13211321
return;
1322-
if ((isDisposed || isTainted) && c.visible)
1322+
if ((isDisposed || isTainted) && c.isVisible()) {
1323+
// c.visible not the same as c.isVisible() for popup!!
13231324
setVisible(true);
1325+
}
13241326
}
13251327
propertyChangedCUI(e, prop);
13261328
}
@@ -2387,7 +2389,7 @@ public void setBounds(int x, int y, int width, int height, int op) {
23872389
if (isBounded && !boundsSet) {
23882390
// now we can set it to be visible, because its bounds have
23892391
// been explicitly set.
2390-
if (c.visible && cellComponent == null)
2392+
if (c.isVisible() && cellComponent == null)
23912393
setVisible(true);
23922394
boundsSet = true;
23932395
}

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSFrameUI.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@
3333
* this.setName("myframe");
3434
*
3535
*
36-
* 3) On the web page somewhere, create a div with id (name + "-div") and styles
37-
* position:absolute, left, and right. If you wish, you can set the width and
38-
* height, but that is optional. All four of these values override whatever is
39-
* given in the constructor.
36+
* 3) On the web page somewhere, create a div with id (appletname-name-div)
37+
* where appletname is the applet name (e.g. "testApplet") and styles
38+
* position:absolute;left:<nnn>px;top:<nnn>px.
4039
*
41-
* &lt;div id="myframe-div"
40+
* If you wish, you can set the width and height, but that is optional. All four
41+
* of these values override whatever is given in the constructor.
42+
*
43+
* &lt;div id="testApplet-myframe-div"
4244
* style="position:absolute;left:100px;top:200px;width:400px;height:300px"
4345
* &gt;&lt;/div&gt;
4446
*

sources/net.sf.j2s.java.core/src/test/Test_Array.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
class Test_Array extends Test_ {
99

10+
static Object ax1 =new int[2][];
11+
static Object ax = new int[2][3][];
12+
13+
1014
static int[] i0 = new int[0];
1115
static Object ono = new Class<?>[0];
1216

@@ -25,6 +29,8 @@ class Test_Array extends Test_ {
2529
y = x;
2630
Test_Array[] a = new Test_Array[3];
2731
}
32+
33+
2834
static Object oo = Array.newInstance(Test_Array[].class, 0);
2935

3036
static Object tType3__ = Array.newInstance(Test_Array[][].class, 3);
@@ -137,7 +143,10 @@ public static void main(String[] args) {
137143
assert ((i33 instanceof int[][]));
138144
assert ((iType3_ instanceof int[][]));
139145
assert (!(i33 instanceof int[]));
140-
146+
assert ((new int[2][])[0] == null);
147+
assert ((new int[2][3][])[0][0] == null);
148+
assert(((int[][])i33)[0][0] == 0);
149+
assert(((char[][][][])c33__)[0][0] == null);
141150
int[] ii3 = new int[] { 1, 2, 3 };
142151
ii3[Integer.valueOf(2)] = 1;
143152
int j = ii3[Integer.valueOf(2)];

sources/net.sf.j2s.java.core/srcjs/js/j2sApplet.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// j2sApplet.js BH = Bob Hanson hansonr@stolaf.edu
22

3+
// BH 2023.01.10 j2sargs typo
34
// BH 2022.08.27 fix frame resizing for browsers reporting noninteger pageX, pageY
45
// BH 2022.06.23 implements J2S._lastAppletID
56
// BH 2022.01.12 adds pointer option
@@ -2746,7 +2747,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
27462747
}
27472748
J2S._registerApplet(applet._id, applet);
27482749
if (J2S._appArgs || applet.__Info.args == "?") {
2749-
applet.__Info.args = (J2S._appArgs ? decodeURIComponent(J2S.appArgs).split("|") : []);
2750+
applet.__Info.args = (J2S._appArgs ? decodeURIComponent(J2S._appArgs).split("|") : []);
27502751
}
27512752
J2S._lang && (applet.__Info.language = J2S._lang);
27522753
var isApp = applet._isApp = !!applet.__Info.main;

0 commit comments

Comments
 (0)