Bonjour tout le monde. Je me tourne une fois encore vers vs pour un problème que je n'arrive pas à comprende.
J'ai crée mon interface avec swt en choisissant Application wibdow dont le code généré est le suivant
et lorsque je clique sur disign afin de deposer les composants, il me ferme tous mon eclipse. J'ai le même problème avec le swt dialog donc vs avez egalement le code généré suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 package fc.MVVM; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class ApplicationVues { protected Shell shell; /** * Launch the application. * @param args */ public static void main(String[] args) { try { ApplicationVues window = new ApplicationVues(); window.open(); } catch (Exception e) { e.printStackTrace(); } } /** * Open the window. */ public void open() { Display display = Display.getDefault(); createContents(); shell.open(); shell.layout(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } //display.sleep(); } /** * Create contents of the window. */ protected void createContents() { shell = new Shell(); shell.setSize(450, 300); shell.setText("SWT Application"); } }
Je vous remercie d'avance pour vos reponses.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 package fc.MVVM; import org.eclipse.swt.widgets.Dialog; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class Client extends Dialog { protected Object result; protected Shell shell; /** * Create the dialog. * @param parent * @param style */ public Client(Shell parent, int style) { super(parent, style); setText("SWT Dialog"); } /** * Open the dialog. * @return the result */ public Object open() { createContents(); shell.open(); shell.layout(); Display display = getParent().getDisplay(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return result; } /** * Create contents of the dialog. */ private void createContents() { shell = new Shell(getParent(), getStyle()); shell.setSize(450, 300); shell.setText(getText()); } }
Partager