IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

SWT/JFace Java Discussion :

scroll vertical dans un wizard


Sujet :

SWT/JFace Java

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Février 2008
    Messages
    108
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2008
    Messages : 108
    Points : 57
    Points
    57
    Par défaut scroll vertical dans un wizard
    bonjour,
    je viens de creer un wizard et ma page contient plusieurs champs texte( 18 en tt ) qui s'aligne verticalement les uns apres les autres .Mon probleme c'est que jarrive pas a voir les champs qui depasse la fenetre!! il me faut un scroll verticale




    jai essayé un ScrolledComposite mais il mefface tt les champs, il maffiche juste un wizard vide!! voila un bout de mon programme
    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
    public void createControl(Composite parent) {
    	   //composite= new ScrolledComposite(parent,SWT.V_SCROLL);
    		composite = new Composite(parent, SWT.V_SCROLL);
    		composite.setLayout(new GridLayout(2, true));
     
    		GridLayout layout = new GridLayout();
    		GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
     
    		layout.verticalSpacing=15;
    		composite.setLayout(layout);
    		layout.numColumns =2;
    		layout.marginTop=10;
    		layout.horizontalSpacing =200;
     
    		final Button dir=new Button(composite,SWT.RADIO);
    		dir.setText("Grammaire direct");
    		final Button ext=new Button(composite,SWT.RADIO);
    		ext.setText("Grammaire externe");
     
    //il ya 17 autre label crée apres celui la 
     
    		Label label = new Label(composite, SWT.NORMAL);
    	    label.setText("Version ");
    	    final Text text = new Text(composite, SWT.HIDE_SELECTION| SWT.BORDER);
    	    gridData.horizontalIndent = -240;
    	    text.setLayoutData(gridData);

    merci d'avance

  2. #2
    Expert éminent
    Avatar de djo.mos
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    4 666
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2004
    Messages : 4 666
    Points : 7 679
    Points
    7 679
    Par défaut
    Salut,
    Il est vrai que ScrolledComposite est un casse gueule

    Sinon, voici un exemple fonctionnel :

    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
    final ScrolledComposite sc = new ScrolledComposite(parent,
    					SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    			sc.setLayout(new FillLayout());
    			sc.setExpandHorizontal(true);
    			sc.setExpandVertical(true);
    			sc.setMinSize(0, 0);
    			final Composite comp = new Composite(sc, SWT.NONE);
    			comp.setLayout(new GridLayout(1, false));
    			for (int i = 0; i < 60; i++) {
    				Text t = new Text(comp, SWT.SINGLE);
    				t.setText(i + "");
    			}
     
    			comp.addControlListener(new ControlAdapter() {
     
    				public void controlResized(ControlEvent e) {
    					Point s = comp.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    					sc.setMinSize(s);
     
    				}
     
    			});
    			sc.setContent(comp);
    			Point s = comp.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    			sc.setMinSize(s);
    			setControl(sc);

  3. #3
    Membre averti

    Profil pro
    Inscrit en
    Août 2006
    Messages
    218
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Août 2006
    Messages : 218
    Points : 305
    Points
    305
    Par défaut
    Salut

    En mixant ton code et l'exemple au-dessus, ça donne ce truc :

    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
     
        public void createControl(Composite parent) {
            final ScrolledComposite sc = new ScrolledComposite(parent, SWT.V_SCROLL|SWT.H_SCROLL);
            sc.setExpandHorizontal(true);
            sc.setExpandVertical(true);
            sc.setMinSize(0, 0);
     
            // Là tu as ton code initial
            final Composite composite = new Composite(sc, SWT.NONE);
            composite.setLayout(new GridLayout(2, true));
     
            GridLayout layout = new GridLayout();
            GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
     
            layout.verticalSpacing = 15;
            composite.setLayout(layout);
            layout.numColumns = 2;
            layout.marginTop = 10;
            layout.horizontalSpacing = 200;
     
            final Button dir = new Button(composite, SWT.RADIO);
            dir.setText("Grammaire direct");
            final Button ext = new Button(composite, SWT.RADIO);
            ext.setText("Grammaire externe");
     
            // il ya 17 autre label crée apres celui la : j'ai fais joujou !
            for (int i = 0; i < 18; i++) {
                Label label = new Label(composite, SWT.NORMAL);
                label.setText("Version " + i);
                final Text text = new Text(composite, SWT.HIDE_SELECTION | SWT.BORDER);
                gridData.horizontalIndent = -240;
                text.setLayoutData(gridData);
            }
     
            // Important !
            composite.addControlListener(new ControlAdapter() {
     
                public void controlResized(ControlEvent e) {
                    Point s = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
                    sc.setMinSize(s);
     
                }
     
            });
     
            sc.setContent(composite);
            Point s = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
            sc.setMinSize(s);
     
     
        }
    Et voilà

    Laurent

  4. #4
    Membre du Club
    Profil pro
    Inscrit en
    Février 2008
    Messages
    108
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2008
    Messages : 108
    Points : 57
    Points
    57
    Par défaut
    merci bcp ca marche


    juste une derniere question: le scrolle ne saffiche pas directement il fo que dimensionne un peu ma fenetre pour kil safffiche, ya til une methode pour cela ??
    jai redimensionné mon shell avec la methode setsize() mais ca marche pas

  5. #5
    Membre averti

    Profil pro
    Inscrit en
    Août 2006
    Messages
    218
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Août 2006
    Messages : 218
    Points : 305
    Points
    305
    Par défaut
    Tu as essayé de faire un pack sur le composite créé par createControl() ?

  6. #6
    Membre du Club
    Profil pro
    Inscrit en
    Février 2008
    Messages
    108
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2008
    Messages : 108
    Points : 57
    Points
    57
    Par défaut
    Citation Envoyé par meddle Voir le message
    Tu as essayé de faire un pack sur le composite créé par createControl() ?
    c bon ca marche le scroll saffiche directement

    il ya juste ma fenetre ki prend tt l'ecran a la verticale!!
    jarrive pas a la dimensionné

  7. #7
    Membre averti

    Profil pro
    Inscrit en
    Août 2006
    Messages
    218
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Août 2006
    Messages : 218
    Points : 305
    Points
    305
    Par défaut
    Tu peux poster le code de ta vue s'il te plait ?

    Laurent

  8. #8
    Membre du Club
    Profil pro
    Inscrit en
    Février 2008
    Messages
    108
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2008
    Messages : 108
    Points : 57
    Points
    57
    Par défaut
    Citation Envoyé par meddle Voir le message
    Tu peux poster le code de ta vue s'il te plait ?

    Laurent


    ma classe qui affiche tt les champs texte

    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
    public class GrammarAttribut extends WizardPage {
     
    	private Composite composite;
     
     
    	public GrammarAttribut() {
    		super("GrammarAttribut ");
    		setTitle("GrammarAttributs");
    		setDescription("Choisissez un type de grammaire");
     
    	}
     
    	@Override
    	public void createControl(Composite parent) {
     
     
    		final ScrolledComposite sc = new ScrolledComposite(parent,
    				SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    		sc.setLayout(new FillLayout());
    		sc.setExpandHorizontal(true);
    		sc.setExpandVertical(true);
    		sc.setMinSize(100, 0);
    		composite = new Composite(sc, SWT.NONE);
    		composite.setLayout(new GridLayout(2, true));
     
     
     
    		composite.addControlListener(new ControlAdapter() {
     
    			public void controlResized(ControlEvent e) {
    				Point s = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    				sc.setMinSize(s);
     
    			}
     
    		});
    		sc.setContent(composite);
    		Point s = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    		sc.setMinSize(s);
    		setControl(sc);
     
     
    		GridLayout layout = new GridLayout();
    		GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
     
    		layout.verticalSpacing=15;
    		composite.setLayout(layout);
    		layout.numColumns =2;
    		layout.marginTop=15;
    		layout.horizontalSpacing =219;
     
    		final Button dir=new Button(composite,SWT.RADIO);
    		dir.setText("Grammaire direct");
    		final Button ext=new Button(composite,SWT.RADIO);
    		ext.setText("Grammaire externe");
     
     
    		Label label = new Label(composite, SWT.NORMAL);
    		label.setText("Version ");
    		final Text text = new Text(composite, SWT.SINGLE| SWT.BORDER);
    		gridData.horizontalIndent = -300;
    		text.setLayoutData(gridData);
     
    		Label label2 = new Label(composite, SWT.NORMAL);
    		label2.setText("xml:lang ");
    		final Text text2 = new Text(composite, SWT.SINGLE| SWT.BORDER);
    		gridData.horizontalIndent = -240;
    		text2.setLayoutData(gridData);
     
    		Label label3 = new Label(composite, SWT.NORMAL);
    		label3.setText("mode ");
    		final Text text3 = new Text(composite, SWT.SINGLE| SWT.BORDER);
    		gridData.horizontalIndent = -240;
    		text3.setLayoutData(gridData);
     
     
    		Label label4 = new Label(composite, SWT.NORMAL);
    		label4.setText("tag-format ");
    		final Text text4 = new Text(composite, SWT.SINGLE| SWT.BORDER);
    		gridData.horizontalIndent = -240;
    		text4.setLayoutData(gridData);
     
     
    		Label label5 = new Label(composite, SWT.NORMAL);
    		label5.setText("xml:base ");
    		final Text text5 = new Text(composite, SWT.SINGLE| SWT.BORDER);
    		gridData.horizontalIndent =-240;
    		text5.setLayoutData(gridData);
    .....
    ma classe main

    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
    public class GrammarMain extends Wizard {
     
    	private GrammarAttribut one;
    	private GrammarElements two;
     
    	static final String DIALOG_SETTING_FILE = "InfoFormulaire.xml";
     
    	static final String KEY_dialogname = "NomFormulaire";
    	static final String KEY_Variablename = "Nomvariable";
    	static final String KEY_Valeurvariable = "Valeurvariable";
    	static final String KEY_Nameelement = "NomElement";
    	static final String KEY_elementvalue= "ValeurElement";
     
    	GrammarModel data = new GrammarModel();
     
     
    	public static void main(String[] args) { 
     
    		Display display = new Display();
    		final Shell shell = new Shell(display);
    		shell.setText("Edition d'un formulaire");
     
    		shell.setLayout(new FillLayout());
     
     
    		GrammarMain wizard = new GrammarMain();
    		WizardDialog dialog = new WizardDialog(shell,wizard);
    		dialog.create();
    		dialog.open();
     
     
    		while (!shell.isDisposed()) {
    			if (!display.readAndDispatch())
    				display.sleep();
    		}
     
    		display.dispose();
    	}
    ......

  9. #9
    Membre du Club
    Profil pro
    Inscrit en
    Février 2008
    Messages
    108
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2008
    Messages : 108
    Points : 57
    Points
    57
    Par défaut
    c bon jai trouvé

    pour editer la taille du wizzard il fo ajouter ces 2 methodes:


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    setPageSize();
    setMinimumPageSize();
    exemple :

    dialog.setPageSize(100, 100);
    dialog.setMinimumPageSize(100, 100);

    merci a tous

  10. #10
    Membre du Club
    Profil pro
    Inscrit en
    Février 2008
    Messages
    108
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2008
    Messages : 108
    Points : 57
    Points
    57
    Par défaut
    je veux creer un 2eme composite dans mon wizard mais fixe sans le scroll!!!! mon probleme c'est quand je creer ce composite il est caché deriere le premier composite scrollé que j'ai creer grace a la methode donnee au dessus .

    j'arrive a le voir grace au tout petit espace qui reste entre la zone de contenu du wizard et la zone de dialogue qui contient le scroll

    est ce que c'est possible de definir une taille pour le composite scrollé pour que je puisse voir mon 2eme composite????

    merci

  11. #11
    Membre averti

    Profil pro
    Inscrit en
    Août 2006
    Messages
    218
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Août 2006
    Messages : 218
    Points : 305
    Points
    305
    Par défaut
    Bonjour,

    Même punition que d'habitude
    Tu peux poster ton code complet, merci

    Laurent

  12. #12
    Membre du Club
    Profil pro
    Inscrit en
    Février 2008
    Messages
    108
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2008
    Messages : 108
    Points : 57
    Points
    57
    Par défaut
    Citation Envoyé par meddle Voir le message
    Bonjour,

    Même punition que d'habitude
    Tu peux poster ton code complet, merci

    Laurent

    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
    95
     
    @Override
    	public void createControl(Composite parent) {
     
     
    		sc = new ScrolledComposite(parent,SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    		sc.setLayout(new FillLayout());
    		sc.setExpandHorizontal(true);
    		sc.setExpandVertical(true);
    		sc.setMinSize(100, 0);
    		composite = new Composite(sc, SWT.NONE);
    		composite.setLayout(new GridLayout(2, true));
    		composite.addControlListener(new ControlAdapter() {
    			public void controlResized(ControlEvent e) {
    				Point s = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    				sc.setMinSize(s);
    			}
    		});
    		sc.setContent(composite);
    		Point s = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    		sc.setMinSize(s);
    		setControl(sc);
     
     
    		GridLayout layout = new GridLayout();
    		GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
     
    		layout.verticalSpacing=15;
    		composite.setLayout(layout);
    		layout.numColumns =2;
    		layout.marginTop=15;
    		layout.horizontalSpacing =230;
     
    		dir=new Button(composite,SWT.RADIO);
    		dir.setText("Grammaire directe");
    		dir.setToolTipText("grammaire directe");
     
    		ext=new Button(composite,SWT.RADIO);
    		ext.setText("Grammaire externe");
    		ext.setToolTipText("grammaire externe");
    		createLine(composite, 2);
     
     
     
    		Label label = new Label(composite, SWT.NORMAL);
    		label.setText("Version ");
    		label.setToolTipText("Version de la grammaire.'Version= 1.0' par défaut");
    		final Text text = new Text(composite, SWT.SINGLE| SWT.BORDER);
    		gridData.horizontalIndent = -300;
    		text.setLayoutData(gridData);
    		text.setText("1.0");
    		text.setEditable(false);**/
     
    		Label label2 = new Label(composite, SWT.NORMAL);
    		label2.setText("xml:lang ");
    		label2.setToolTipText("Identificateur de langue");
    		text2 = new Text(composite, SWT.SINGLE| SWT.BORDER);
    		gridData.horizontalIndent = -240;
    		text2.setLayoutData(gridData);
    		text2.addListener(SWT.Modify, new Listener() {
    			public void handleEvent(Event event) {
    				// String text = text2.getText().trim();
    				((GrammarMain)getWizard()).data.textlang =text2.getText();
    			}
    		});
     
     
    		Label label3 = new Label(composite, SWT.NORMAL);
    		label3.setText("mode ");
    		label3.setToolTipText("Mode de la grammaire.Voice ou DTMF");
    		combomode = new Combo(composite, SWT.READ_ONLY|SWT.DROP_DOWN|SWT.SIMPLE);
    		combomode.add("voice");
    		combomode.add("DTMF");
    		combomode.setLayoutData(gridData);
    		combomode.addListener(SWT.Selection, new Listener() {
    			public void handleEvent(Event event) {
    				// String text = text2.getText().trim();
    				((GrammarMain)getWizard()).data.textmode =combomode.getText();
     
    			}
    		});
     
    		Label label6 = new Label(composite, SWT.NORMAL);
    		label6.setText("root");
    		label6.setToolTipText("Règle qui agit comme règle racine de la grammaire");
    		text6 = new Text(composite, SWT.SINGLE| SWT.BORDER);
    		gridData.horizontalIndent = -240;
    		text6.setLayoutData(gridData);	
    		text6.addListener(SWT.Modify, new Listener() {
    			public void handleEvent(Event event) {
    				// String text = text2.getText().trim();
    				((GrammarMain)getWizard()).data.textroot=text6.getText();
     
    			}
    		});
    je veux donc séparer mes 2 boutons dir et ext du scroll pour qu'il soit tjrs visible!!


    merci encore

  13. #13
    Membre averti

    Profil pro
    Inscrit en
    Août 2006
    Messages
    218
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Août 2006
    Messages : 218
    Points : 305
    Points
    305
    Par défaut
    Salut,

    Moi à ta place je ferais deux composites :
    a) un composite avec tes deux boutons "fixes"
    b) le scrolled composite en dessous

    Et hop, ca roule !


    Laurent

  14. #14
    Membre du Club
    Profil pro
    Inscrit en
    Février 2008
    Messages
    108
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2008
    Messages : 108
    Points : 57
    Points
    57
    Par défaut
    Citation Envoyé par meddle Voir le message
    Salut,

    Moi à ta place je ferais deux composites :
    a) un composite avec tes deux boutons "fixes"
    b) le scrolled composite en dessous

    Et hop, ca roule !


    Laurent
    oui c cke je voulai faire mais le premier cache le 2eme

  15. #15
    Membre averti

    Profil pro
    Inscrit en
    Août 2006
    Messages
    218
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Août 2006
    Messages : 218
    Points : 305
    Points
    305
    Par défaut
    bonjour,

    Je pense que le problème vient du layout sur ton Shell, qui est un fillLayout.

    Voici un exemple avec des GridLayout qui marche bien :

    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
    95
    96
    97
    98
    99
     
    import org.eclipse.swt.SWT;
    import org.eclipse.swt.custom.ScrolledComposite;
    import org.eclipse.swt.events.ControlAdapter;
    import org.eclipse.swt.events.ControlEvent;
    import org.eclipse.swt.graphics.Point;
    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.Label;
    import org.eclipse.swt.widgets.Shell;
    import org.eclipse.swt.widgets.Text;
     
    public class Exemple {
     
        public static void createControl(Composite parent) {
            final Composite top = new Composite(parent, SWT.BORDER);
            top.setLayout(new GridLayout(2,true));
            final Button btn1 = new Button(top, SWT.PUSH);
            btn1.setText("Bouton 1");
            btn1.setLayoutData(new GridData(GridData.BEGINNING, GridData.FILL, false,true));
     
            final Button btn2 = new Button(top, SWT.PUSH);
            btn2.setText("Bouton 1");
            btn2.setLayoutData(new GridData(GridData.END, GridData.FILL, false,true));
     
     
            final ScrolledComposite sc = new ScrolledComposite(parent, SWT.V_SCROLL|SWT.H_SCROLL);
            sc.setExpandHorizontal(true);
            sc.setExpandVertical(true);
            sc.setMinSize(0, 0);
            sc.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
     
            // Là tu as ton code initial
            final Composite composite = new Composite(sc, SWT.NONE);
            composite.setLayout(new GridLayout(2, true));
     
            GridLayout layout = new GridLayout();
            GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
     
            layout.verticalSpacing = 15;
            composite.setLayout(layout);
            layout.numColumns = 2;
            layout.marginTop = 10;
            layout.horizontalSpacing = 200;
     
            final Button dir = new Button(composite, SWT.RADIO);
            dir.setText("Grammaire direct");
            final Button ext = new Button(composite, SWT.RADIO);
            ext.setText("Grammaire externe");
     
            // il ya 17 autre label crée apres celui la : j'ai fais joujou !
            for (int i = 0; i < 18; i++) {
                Label label = new Label(composite, SWT.NORMAL);
                label.setText("Version " + i);
                final Text text = new Text(composite, SWT.HIDE_SELECTION | SWT.BORDER);
                gridData.horizontalIndent = -240;
                text.setLayoutData(gridData);
            }
     
            // Important !
            composite.addControlListener(new ControlAdapter() {
     
                public void controlResized(ControlEvent e) {
                    Point s = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
                    sc.setMinSize(s);
     
                }
     
            });
     
            sc.setContent(composite);
            Point s = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
            sc.setMinSize(s);
     
     
        }
     
     
     
        public static void main(String[] args) {
            Display display = new Display();
            Shell shell = new Shell(display);
            shell.setLayout(new GridLayout(1,false));
     
            createControl(shell);
     
            shell.open();
            while (!shell.isDisposed()) {
                if (!display.readAndDispatch())
                    display.sleep();
            }
            display.dispose();
        }
     
     
    }
    Tiens moi au courant

    Laurent

  16. #16
    Membre du Club
    Profil pro
    Inscrit en
    Février 2008
    Messages
    108
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2008
    Messages : 108
    Points : 57
    Points
    57
    Par défaut
    Un grand merci laurent!! heuresement que t'es la

  17. #17
    Membre averti

    Profil pro
    Inscrit en
    Août 2006
    Messages
    218
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Août 2006
    Messages : 218
    Points : 305
    Points
    305
    Par défaut
    De rien, n'oublie pas de mettre le post en résolu

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 1
    Dernier message: 16/12/2010, 08h36
  2. scroll vertical dans formulaire
    Par ludobabs dans le forum Langage
    Réponses: 2
    Dernier message: 07/05/2008, 14h31
  3. Separateur vertical dans une ListCtrl
    Par jul54 dans le forum MFC
    Réponses: 2
    Dernier message: 15/01/2004, 15h33
  4. Scroll automatique dans un JTextPane
    Par regbegpower dans le forum Composants
    Réponses: 9
    Dernier message: 11/11/2003, 09h24
  5. scrolling vertical et horizontal
    Par myriam dans le forum MFC
    Réponses: 2
    Dernier message: 24/01/2003, 17h06

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo