r(JOptionPane.NO); 194 }); 195 } 196 if((buttons & CANCEL) == CANCEL){ 197 pane.addButton(pane.getCancelButton()); 198 pane.addCloseListener(pane.getCancelButton()); 199 pane.getCancelButton().addActionListener(function(){ 200 handler(JOptionPane.CANCEL); 201 }); 202 } 203 if((buttons & CLOSE) == CLOSE){ 204 pane.addButton(pane.getCloseButton()); 205 pane.addCloseListener(pane.getCloseButton()); 206 pane.getCloseButton().addActionListener(function(){ 207 handler(JOptionPane.CLOSE); 208 }); 209 } 210 211 frame.addEventListener(JFrame.ON_WINDOW_CLOSING, 212 function(){ 213 handler(JOptionPane.CLOSE); 214 }); 215 216 frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 217 frame.setResizable(false); 218 frame.getContentPane().append(pane, BorderLayout.CENTER); 219 frame.pack(); 220 frame.setLocation((Stage.width-frame.getWidth())/2, (Stage.height-frame.getHeight())/2); 221 frame.show(); 222 return pane; 223 } 224 225 /** 226 * showMessageDialog(title:String, msg:String, finishHandler:Function, defaultValue:String, parentComponent:Component, modal:Boolean, icon:Icon)<br> 227 * showMessageDialog(title:String, msg:String, finishHandler:Function, defaultValue:String, parentComponent:Component, modal:Boolean)<br> 228 * showMessageDialog(title:String, msg:String, finishHandler:Function, defaultValue:String, parentComponent:Component)<br> 229 * showMessageDialog(title:String, msg:String, finishHandler:Function, defaultValue:String)<br> 230 * showMessageDialog(title:String, msg:String, finishHandler:Function) 231 * <p> 232 * Show a message box with specifield title, message, and icon and a TextField to requare 233 * user to input a string. 234 * <p> 235 * for example: 236 * <pre> 237 * var handler:Function = Delegate.create(this, __whenUserEntered); 238 * var pqoCۓCC8 1mKjD ȡKȡKȡKjIF ,I,I#_H 0yKTK7K` ` a a a a a a a a a a a @nCKLtK">?_ o0 XBۓCXBI mKpLJqC6C $_4LBK3p'KC8 D8 E8 F8 G8 H8 I8 J8 K8 L8 M8 N8 O8 hA-HLJTBTBք \R_4L