summaryrefslogtreecommitdiff
path: root/NET/worlds/console/BlockingDialog.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-12 22:33:32 -0800
committerFuwn <[email protected]>2026-02-12 22:33:32 -0800
commitc7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch)
treedf9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/console/BlockingDialog.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/console/BlockingDialog.java')
-rw-r--r--NET/worlds/console/BlockingDialog.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/NET/worlds/console/BlockingDialog.java b/NET/worlds/console/BlockingDialog.java
new file mode 100644
index 0000000..b32b5b8
--- /dev/null
+++ b/NET/worlds/console/BlockingDialog.java
@@ -0,0 +1,47 @@
+package NET.worlds.console;
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+public class BlockingDialog extends Dialog implements ActionListener {
+ private static final long serialVersionUID = 8379457384966170912L;
+ boolean stillWaiting = true;
+
+ public BlockingDialog(Frame parent, String title, boolean modal) {
+ super(parent, title, modal);
+ this.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ BlockingDialog.this.finish();
+ }
+ });
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ this.finish();
+ }
+
+ public void finish() {
+ this.responded();
+ this.setVisible(false);
+ }
+
+ public synchronized void waitForResponse() {
+ try {
+ while (this.stillWaiting) {
+ this.wait();
+ }
+ } catch (Exception var2) {
+ }
+ }
+
+ public synchronized void responded() {
+ this.stillWaiting = false;
+ this.notifyAll();
+ }
+}