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
|
import org.eclipse.swt.*;
public class Main {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
// Création de l'ExpandBar
final ExpandBar expandBarrePrincipale = new ExpandBar(shell, SWT.NONE);
// Créé un composite qui sera stocké dans l'expandBar
final Composite compositePrincipal = new Composite(expandBarrePrincipale, SWT.NONE);
GridLayout layoutPrincipal = new GridLayout(2, true);
compositePrincipal.setLayout(layoutPrincipal);
Label label = new Label(compositePrincipal, SWT.NONE);
label.setImage(display.getSystemImage(SWT.ICON_WARNING));
label = new Label(compositePrincipal, SWT.NONE);
label.setText("SWT.ICON_WARNING");
/**
* ExpandBar secondaire
*/
final ExpandBar expandBarreSecondaire = new ExpandBar(compositePrincipal, SWT.NONE);
expandBarreSecondaire.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
final Composite compositeSecondaire = new Composite(expandBarreSecondaire, SWT.NONE);
compositeSecondaire.setLayout(new GridLayout(2, true));
Label labelSec = new Label(compositeSecondaire, SWT.NONE);
labelSec.setImage(display.getSystemImage(SWT.ICON_INFORMATION));
labelSec = new Label(compositeSecondaire, SWT.NONE);
labelSec.setText("SWT.ICON_INFORMATION");
final ExpandItem itemPrincipal = new ExpandItem(expandBarrePrincipale, SWT.NONE, 0);
itemPrincipal.setText("TRIGGER");
itemPrincipal.setHeight(compositePrincipal.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
itemPrincipal.setControl(compositePrincipal);
final ExpandItem itemSecondaire = new ExpandItem(expandBarreSecondaire, SWT.NONE, 0);
itemSecondaire.setText("TRIGGER 2(le retour)");
itemSecondaire.setHeight(compositeSecondaire.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
itemSecondaire.setControl(compositeSecondaire);
/**
* Fin ExpandBar secondaire
*/
label = new Label(compositePrincipal, SWT.NONE);
label.setImage(display.getSystemImage(SWT.ICON_QUESTION));
label = new Label(compositePrincipal, SWT.NONE);
label.setText("SWT.ICON_QUESTION");
// /**
// * ExpandBar secondaire
// */
// final ExpandBar expandBarreSecondaire = new ExpandBar(compositePrincipal, SWT.NONE);
// expandBarreSecondaire.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
//
// final Composite compositeSecondaire = new Composite(expandBarreSecondaire, SWT.NONE);
// compositeSecondaire.setLayout(new GridLayout(2, true));
//
// Label labelSec = new Label(compositeSecondaire, SWT.NONE);
// labelSec.setImage(display.getSystemImage(SWT.ICON_INFORMATION));
// labelSec = new Label(compositeSecondaire, SWT.NONE);
// labelSec.setText("SWT.ICON_INFORMATION");
//
// final ExpandItem itemSecondaire = new ExpandItem(expandBarreSecondaire, SWT.NONE, 0);
// itemSecondaire.setText("TRIGGER 2(le retour)");
// itemSecondaire.setHeight(compositeSecondaire.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
// itemSecondaire.setControl(compositeSecondaire);
//
// /**
// * Fin ExpandBar secondaire
// */
itemPrincipal.setHeight(compositePrincipal.computeSize(SWT.DEFAULT, SWT.DEFAULT).y + compositeSecondaire.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
// Fin d'implémentation du test
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
} |
Partager