swing-ui 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SwingUI.js CHANGED
@@ -668,7 +668,7 @@ export class SwingUI
668
668
  callback.call(e.target, e);
669
669
  }catch(ex)
670
670
  {
671
- let comp_name = e.target.constructor.name;
671
+ let comp_name = e.target?.constructor?.name;
672
672
  e.target = `${comp_name}{...}`; // make it shorter by hiding internals of component
673
673
  if(e.source != null) e.source = `${e.source.constructor.name}{...}`; // make it shorter by hiding internals of component
674
674
  error(`${this._msg[6]}${comp_name}: ${e.event} \n\n${ex.stack}\n\nEvent ${stringify(e)}`, false);
@@ -1245,6 +1245,28 @@ export class SwingUI
1245
1245
  }
1246
1246
  }
1247
1247
 
1248
+ /**
1249
+ * Sets/get whether double-buffering should be used in rendering GUI in Java. Disabling may help to fix some graphical issues in Linux if flickering happens on component repaint.
1250
+ *
1251
+ * @param {boolean} enabled - `true` to enable double-buffering (default), `false` to disable.
1252
+ * @return {SwingUI|boolean} When setting a value, an instance of this `ui` object is returned, otherwise a current value is returned.
1253
+ */
1254
+ doubleBuffer(...args)
1255
+ {
1256
+ if(args.length > 0)
1257
+ {
1258
+ this.sendToGUI({java: "doubleBuffer", value: args[0] === true});
1259
+ return this;
1260
+ }
1261
+ else
1262
+ {
1263
+ return /** @type {boolean} */ this.sendToGUI({java: "doubleBuffer"}, r =>
1264
+ {
1265
+ return r.value;
1266
+ });
1267
+ }
1268
+ }
1269
+
1248
1270
  /**
1249
1271
  * Shows a message dialog window like alert() in web browser.
1250
1272
  *
package/classes/Arc.js CHANGED
@@ -96,7 +96,7 @@ export class Arc extends Shape
96
96
  }
97
97
  else
98
98
  {
99
- return {width: this._size.width, height: this._size.height};
99
+ return {width: this._hole_size.width, height: this._hole_size.height};
100
100
  }
101
101
  }
102
102
 
@@ -182,4 +182,4 @@ export class Arc extends Shape
182
182
 
183
183
  return obj;
184
184
  }
185
- }
185
+ }
package/icon.png CHANGED
Binary file
package/jar/gui-11.jar CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swing-ui",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Cross-platform Graphic User Interface for Node.js, Bun and Deno 2+",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,7 +14,6 @@ export class ComponentContainer extends UIComponent {
14
14
  * @ignore
15
15
  */
16
16
  constructor(...args: any[]);
17
- applyComponentProperties: any;
18
17
  /**
19
18
  * Loads UI Components and properties from UI designer file FILE_NAME.ui.json where FILE_NAME is the name of JavaScript file of the component.
20
19
  *
@@ -22,7 +21,15 @@ export class ComponentContainer extends UIComponent {
22
21
  * @private
23
22
  * @ignore
24
23
  */
25
- private applyUIDefinition;
24
+ private _applyUIDefinition;
25
+ /**
26
+ * @private
27
+ */
28
+ private _applyComponentPropertiesV1_0;
29
+ /**
30
+ * @private
31
+ */
32
+ private _buildComponentResources;
26
33
  /**
27
34
  * Gets an array of child components.
28
35
  *
@@ -122,10 +129,6 @@ export class ComponentContainer extends UIComponent {
122
129
  * };
123
130
  */
124
131
  onContainerEvents(...args: any[]): this | Function[];
125
- /**
126
- * @private
127
- */
128
- private applyComponentPropertiesV1_0;
129
132
  #private;
130
133
  }
131
134
  import { UIComponent } from "./UIComponent.js";
@@ -176,11 +176,11 @@ export class UIComponent {
176
176
  verifyComponent(): this;
177
177
  /**
178
178
  * Checks if this component is inside specified ancestor component (at any level, not just direct child).
179
- * @param {Object} ancestor - Ancestor component to test against
179
+ * @param {UIComponent} ancestor - Ancestor component to test against
180
180
  * @return {boolean}
181
181
  * @see ComponentContainer#contains
182
182
  */
183
- insideOf(ancestor: Object): boolean;
183
+ insideOf(ancestor: UIComponent): boolean;
184
184
  /**
185
185
  * Sets or gets component's visibility.
186
186
  * NOTE: Window and InternalWindow components visibility is set to `false` by default. Use .visible(true) or .show() to make it visible.
@@ -58,7 +58,7 @@ async function startJar()
58
58
  let JAVA_OPTS = (env.JAVA_OPTS ?? "").split(" ").filter(Boolean);
59
59
  if(JAVA_OPTS.indexOf("-Dfile.encoding=UTF-8") === -1) JAVA_OPTS.push("-Dfile.encoding=UTF-8"); // important
60
60
  if(workerData.debugJava) JAVA_OPTS.push("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005"); // for debugging JAR
61
- if(workerData.os === "linux") JAVA_OPTS.push("--add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED"); // to be able to set WM_CLASS to project name in Java GUI
61
+ if(workerData.os === "linux") JAVA_OPTS.push("--add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED"); // to be able to set WM_CLASS to project name in Java GUI
62
62
 
63
63
  const _opts = [...JAVA_OPTS, "-jar", JAR_PATH, "--root-dir", workerData.rootDir, "--module-dir", workerData.moduleDir];
64
64