Skip to content

Commit f8f3ed5

Browse files
committed
minor fix for JSframeUI not embedding properly
ensures that the desired frame size is created.
1 parent cbf4dac commit f8f3ed5

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20250326134231
1+
20250413104722
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20250326134231
1+
20250413104722
-900 Bytes
Binary file not shown.

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import javax.swing.JComponent;
1515
import javax.swing.JFrame;
1616
import javax.swing.LookAndFeel;
17+
import javax.swing.SwingUtilities;
1718
import javax.swing.Timer;
1819

1920
import swingjs.JSUtil;
@@ -180,9 +181,15 @@ public Object getEmbedded(String type) {
180181
if (dim.width > 0) {
181182
frame.setUndecorated(true);
182183
frame.setLocation(0, 0);
184+
DOMNode.setStyles(containerNode, "width", dim.width + "px", "height", dim.height + "px");
183185
String resize = DOMNode.getStyle(node, "resize");
184-
if (resize == "none")
185-
frame.秘freezeBounds(dim.width, dim.height);
186+
if (resize == "none") {
187+
SwingUtilities.invokeLater(()->{
188+
// this allows the freeze to be after the
189+
// currently executing reshape execution
190+
frame.秘freezeBounds(dim.width, dim.height);
191+
});
192+
}
186193
} else {
187194
DOMNode.setStyles(node, "position", "relative", "overflow", "hidden");
188195
}

0 commit comments

Comments
 (0)