1 30 31 package rcm.awt; 32 33 import java.awt.*; 34 35 public abstract class RunnableDialog extends PopupDialog implements Runnable { 36 37 DialogThread thread; 38 39 public RunnableDialog (Component parent, String title, boolean modal) { 40 super (parent, title, modal); 41 } 42 43 public RunnableDialog (Component parent, String title, boolean modal, 44 String question, String initialEntry, 45 String okOrYes, String no, String cancel) { 46 super (parent, title, modal, question, initialEntry, 47 okOrYes, no, cancel); 48 } 49 50 public void show () { 51 thread = new DialogThread (); 52 thread.start (); 53 super.show (); 54 } 55 56 public abstract void run (); 57 58 class DialogThread extends Thread { 59 public DialogThread () { 60 setPriority (MIN_PRIORITY); 61 } 62 63 public void run () { 64 RunnableDialog.this.run (); 65 if (isShowing ()) 66 dispose (); 67 } 68 } 69 } 70 | Popular Tags |