Skip to content

Commit e656a29

Browse files
committed
Async
1 parent 4c2603b commit e656a29

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

sources/net.sf.j2s.java.core/src/javajs/async/Async.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
package javajs.async;
22

3-
import java.awt.Color;
4-
import java.awt.Component;
5-
import java.awt.event.ActionListener;
6-
73
/**
8-
* A class to manage asynchronous aspects of SwingJS
4+
* A package to manage asynchronous aspects of SwingJS
95
*
106
* The javajs.async package simplifies the production of methods that can be
117
* used equally well in Java and in JavaScript for handling "pseudo-modal"

sources/net.sf.j2s.java.core/src/javajs/async/AsyncDialog.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package javajs.async;
22

33
import java.awt.Component;
4-
import java.awt.Container;
54
import java.awt.event.ActionEvent;
65
import java.awt.event.ActionListener;
76
import java.beans.PropertyChangeEvent;
@@ -67,6 +66,19 @@ public AsyncDialog() {
6766

6867
// These options can be supplemented as desired.
6968

69+
70+
/**
71+
* Synchronous call; OK in JavaScript as long as we are using a JavaScript prompt() call
72+
*
73+
* @param frame
74+
* @param msg
75+
* @return
76+
*/
77+
@Deprecated
78+
public static String showInputDialog(Component frame, String msg) {
79+
return JOptionPane.showInputDialog(frame, msg);
80+
}
81+
7082
public void showInputDialog(Component frame, Object message, ActionListener a) {
7183
setListener(a);
7284
process(JOptionPane.showInputDialog(frame, message));
@@ -151,7 +163,7 @@ public static void showYesNoAsync(Component parent, Object message, String title
151163
* @param title TODO
152164
* @param yes
153165
*/
154-
public static void showYesAsync(Container parent, Object message, String title, Runnable yes) {
166+
public static void showYesAsync(Component parent, Object message, String title, Runnable yes) {
155167
AsyncDialog.showYesNoAsync(parent, message, title, new ActionListener() {
156168

157169
@Override
@@ -171,7 +183,7 @@ public void actionPerformed(ActionEvent e) {
171183
* @param title
172184
* @param ok
173185
*/
174-
public static void showOKAsync(Container parent, Object message, String title, Runnable ok) {
186+
public static void showOKAsync(Component parent, Object message, String title, Runnable ok) {
175187
new AsyncDialog().showConfirmDialog(parent, message, title, JOptionPane.OK_CANCEL_OPTION, new ActionListener() {
176188

177189
@Override
@@ -187,7 +199,9 @@ public void actionPerformed(ActionEvent e) {
187199

188200
private void setListener(ActionListener a) {
189201
actionListener = a;
190-
/** @j2sNative javax.swing.JOptionPane.listener = this */
202+
@SuppressWarnings("unused")
203+
Class c = JOptionPane.class; // loads the class
204+
/** @j2sNative c.$clazz$.listener = this */
191205
}
192206

193207
private void unsetListener() {

0 commit comments

Comments
 (0)