Skip to content

Commit 944ed02

Browse files
committed
moving JSAudioThread, fixing static JQueryUI call
1 parent 2b20e97 commit 944ed02

5 files changed

Lines changed: 40 additions & 9 deletions

File tree

sources/net.sf.j2s.java.core/src/java/lang/Thread.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ public static Thread currentThread() {
297297
* java.lang.Thread.thisThread =
298298
* Clazz.new(java.lang.Thread.c$$S, ["master"]);
299299
* var name = J2S._applets["master"]._id; var g =
300-
* Clazz.new(swingjs.JSThreadGroup.c$$ThreadGroup$S,
300+
* Clazz.new(Clazz.load('swingjs.JSThreadGroup').c$$ThreadGroup$S,
301301
* [null, name]); java.lang.Thread.thisThread =
302-
* Clazz.new(Clazz.loadClass("javajs.util.JSThread").c$$ThreadGroup$S,
302+
* Clazz.new(Clazz.load("javajs.util.JSThread").c$$ThreadGroup$S,
303303
* [g, name]);
304304
*
305305
*/

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

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
package swingjs;
2-
3-
import javajs.util.JSThread;
1+
package javajs.util;
42

53
import javax.sound.sampled.AudioFormat;
64
import javax.sound.sampled.AudioSystem;
@@ -231,5 +229,30 @@ protected void doFinally() {
231229
owner.audioThreadExiting();
232230
}
233231

232+
public interface JSAudioThreadOwner {
233+
234+
/**
235+
*
236+
* @return true if thread should continue; false if not
237+
*
238+
*/
239+
boolean checkSoundStatus();
240+
241+
/** fill audio buffer
242+
*
243+
* @return number of bytes to write to audio line
244+
*
245+
*/
246+
int fillAudioBuffer();
247+
248+
/**
249+
* called from the finally clause when complete
250+
*
251+
*/
252+
void audioThreadExiting();
253+
254+
255+
}
256+
234257
}
235258

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ public void run() {
5858
@Override
5959
public synchronized void start() {
6060

61+
6162
/**
6263
* @j2sNative
6364
*
64-
* swingjs.JSToolkit.dispatch$O$I$I(this, 1, 0);
65+
* Clazz.load("swingjs.JSToolkit").dispatch$O$I$I(this, 1, 0);
6566
*
6667
*/
6768
{

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@
77
//import javajs.J2SRequireImport;
88
import swingjs.JSUtil;
99
import swingjs.api.js.JSSwingMenu;
10+
import swingjs.jquery.JQueryUI;
1011
import swingjs.api.js.DOMNode;
1112

12-
//@J2SRequireImport(swingjs.jquery.JQueryUI.class)
1313
public class JSPopupMenuUI extends JSPanelUI {
1414

15+
static {
16+
Object jqueryui = JQueryUI.class; // loads jQuery.ui
17+
}
18+
1519
// a frameless independent window
1620

1721
static JSSwingMenu j2sSwingMenu;

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@
2020
import sun.swing.DefaultLookup;
2121
import swingjs.JSUtil;
2222
import swingjs.api.js.DOMNode;
23+
import swingjs.jquery.JQueryUI;
2324

24-
//@J2SRequireImport(swingjs.jquery.JQueryUI.class)
2525
@SuppressWarnings({"rawtypes", "unchecked", "unused"})
2626
public class JSSliderUI extends JSLightweightUI implements PropertyChangeListener, ChangeListener {
2727

28-
private static Object jsqueryUI = new swingjs.jquery.JQueryUI();
28+
static {
29+
Object jqueryui = JQueryUI.class; // loads jQuery.ui
30+
}
31+
2932
JSlider jSlider;
3033
private int min, max, val, majorSpacing, minorSpacing;
3134
protected boolean paintTicks;

0 commit comments

Comments
 (0)