Snapshot before changing swt list to comboviewer
[FinalKeyGui.git] / src / fkgui / NewAccountDialog.java
1 package fkgui;
2
3 import org.eclipse.swt.widgets.Dialog;
4 import org.eclipse.swt.widgets.Display;
5 import org.eclipse.swt.widgets.Shell;
6
7 public class NewAccountDialog extends Dialog {
8
9         protected Object result;
10         protected Shell shell;
11
12         /**
13          * Create the dialog.
14          * @param parent
15          * @param style
16          */
17         public NewAccountDialog(Shell parent, int style) {
18                 super(parent, style);
19                 setText("SWT Dialog");
20         }
21
22         /**
23          * Open the dialog.
24          * @return the result
25          */
26         public Object open() {
27                 createContents();
28                 shell.open();
29                 shell.layout();
30                 Display display = getParent().getDisplay();
31                 while (!shell.isDisposed()) {
32                         if (!display.readAndDispatch()) {
33                                 display.sleep();
34                         }
35                 }
36                 return result;
37         }
38
39         /**
40          * Create contents of the dialog.
41          */
42         private void createContents() {
43                 shell = new Shell(getParent(), getStyle());
44                 shell.setSize(450, 300);
45                 shell.setText(getText());
46
47         }
48
49 }