Bonsoir a tous,

Je vous explique mon problème. Je suis en train de développer une GUI et je rencontre quelques problèmes. En effet, j'ai un gridLayout qui me met des marges entre chaques widgets. Forcement le résultat n'est pas celui que j'attend. Je sais pas si c'est possible mais j'aimerai donc supprimer ces marges.

Je vous post un bout de code afin que vous compreniez mieux :
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
 
public class ConfigView{
	private Shell shell;
	private final int _LEFTWIDTH=200;
	private final int _HEIGHT=300;
 
	public ConfigView(Display display,final Shell shellParent){
		shellParent.setEnabled(false);
		shell=new Shell(shellParent,SWT.SHELL_TRIM);
		shell.setSize(700, 500);
		shell.setMinimumSize(_LEFTWIDTH, _HEIGHT);
		shell.setLayout(new FillLayout());
		Composite composite=new Composite(shell, SWT.NONE);
		composite.setLayout(new GridLayout(2,false));
 
		createLeft(composite);
		createRight(composite);
		createSeperator(composite);
		createBottom(composite);
 
		shell.setLocation((display.getClientArea().width-shell.getSize().x)/2, (display.getClientArea().height-shell.getSize().y)/2);
		shell.open();
 
		while (!shell.isDisposed()){
			if(!display.readAndDispatch()){
				display.sleep();
			}
		}
		shell.dispose();
	}
 
	private void createLeft(Composite composite){
		Tree tree=new Tree(composite,SWT.SINGLE);
		tree.pack();
		TreeItem elem=new TreeItem(tree,SWT.NONE);
		elem.setText("ELement numero 1");
		TreeItem elem2=new TreeItem(tree,SWT.NONE);
		elem2.setText("ELement numero 2");
		TreeItem elem3=new TreeItem(tree,SWT.NONE);
		elem3.setText("ELement numero 3");
		TreeItem elem4=new TreeItem(elem,SWT.NONE);
		elem4.setText("ELement numero 4");
		TreeItem elem5=new TreeItem(elem,SWT.NONE);
		elem5.setText("ELement numero 5");
		GridData gridDataLeft=new GridData(GridData.FILL,GridData.FILL,false,true);
		gridDataLeft.widthHint=_LEFTWIDTH;
		tree.setLayoutData(gridDataLeft);
	}
 
	private void createRight(Composite composite){
		Composite comp=new Composite(composite,SWT.NONE);
		GridData gridDataRight=new GridData(GridData.FILL_BOTH);
		comp.setLayoutData(gridDataRight);
	}
 
	private void createSeperator(Composite composite){
		Label separator=new Label(composite,SWT.SEPARATOR|SWT.HORIZONTAL);
		GridData gridDataBottom=new GridData(GridData.FILL,GridData.FILL,true,false);
		gridDataBottom.horizontalSpan=3;
		separator.setLayoutData(gridDataBottom);
	}
 
	private void createBottom(Composite composite){
		Composite comp=new Composite(composite,SWT.NONE);
		GridData gridDataBottom=new GridData(GridData.FILL,GridData.FILL,true,false);
		gridDataBottom.horizontalSpan=2;
		comp.setLayoutData(gridDataBottom);
 
 
		comp.setLayout(new GridLayout(2,false));
		Button btnOk=new Button(comp, SWT.NONE);
		Button btnCancel=new Button(comp, SWT.NONE);
		btnOk.setText("Ok");
		btnCancel.setText("Annuler");
		GridData gridDataOk=new GridData(SWT.RIGHT,SWT.CENTER,true,false);
		btnOk.setLayoutData(gridDataOk);
 
 
	}
}