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

GWT et Vaadin Java Discussion :

Mettre en colonne plusieur HorizontalPanel


Sujet :

GWT et Vaadin Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 56
    Par défaut Mettre en colonne plusieur HorizontalPanel
    En fait, je dispose plusieurs HorizontalPanel à la suite dans un verticalPanel et je voudrais pouvoir effectuer des colonnes, je vous donne mon code.

    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
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
     
    package com.gwt.client.Panel;
     
    import com.google.gwt.user.client.ui.HorizontalPanel;
    import com.google.gwt.user.client.ui.Label;
    import com.google.gwt.user.client.ui.ListBox;
    import com.google.gwt.user.client.ui.RadioButton;
    import com.google.gwt.user.client.ui.TextBox;
    import com.google.gwt.user.client.ui.VerticalPanel;
     
    public class PanelMessagePage extends VerticalPanel{
     
    	/*private String Ligne1;
    	private String Ligne2;
    	private String Ligne3;
    	private String Ligne4;
    	private String Ligne5;
    	private String Ligne6;*/
    	private TextBox txtLigne1 = new TextBox();
    	private RadioButton clTrue1 = new RadioButton("clignotement1", "Actif");
    	private RadioButton clFalse1 = new RadioButton("clignotement1", "Desactivé");
    	private RadioButton justG1 = new RadioButton("justification1", "Gauche");
    	private RadioButton justC1 = new RadioButton("justification1", "Centre");
    	private ListBox couleur1 = new ListBox ();
    	private TextBox txtLigne2 = new TextBox();
    	private RadioButton clTrue2 = new RadioButton("clignotement2", "Actif");
    	private RadioButton clFalse2 = new RadioButton("clignotement2", "Desactivé");
    	private RadioButton justG2 = new RadioButton("justification2", "Gauche");
    	private RadioButton justC2 = new RadioButton("justification2", "Centre");
    	private ListBox couleur2 = new ListBox ();
    	private TextBox txtLigne3 = new TextBox();
    	private RadioButton clTrue3 = new RadioButton("clignotement3", "Actif");
    	private RadioButton clFalse3 = new RadioButton("clignotement3", "Desactivé");
    	private RadioButton justG3 = new RadioButton("justification3", "Gauche");
    	private RadioButton justC3 = new RadioButton("justification3", "Centre");
    	private ListBox couleur3 = new ListBox ();
    	private TextBox txtLigne4 = new TextBox();
    	private RadioButton clTrue4 = new RadioButton("clignotement4", "Actif");
    	private RadioButton clFalse4 = new RadioButton("clignotement4", "Desactivé");
    	private RadioButton justG4 = new RadioButton("justification4", "Gauche");
    	private RadioButton justC4 = new RadioButton("justification4", "Centre");
    	private ListBox couleur4 = new ListBox ();
    	private TextBox txtLigne5 = new TextBox();
    	private RadioButton clTrue5 = new RadioButton("clignotement5", "Actif");
    	private RadioButton clFalse5 = new RadioButton("clignotement5", "Desactivé");
    	private RadioButton justG5 = new RadioButton("justification5", "Gauche");
    	private RadioButton justC5 = new RadioButton("justification5", "Centre");
    	private ListBox couleur5 = new ListBox ();
    	private TextBox txtLigne6 = new TextBox();
    	private RadioButton clTrue6 = new RadioButton("clignotement6", "Actif");
    	private RadioButton clFalse6 = new RadioButton("clignotement6", "Desactivé");
    	private RadioButton justG6 = new RadioButton("justification6", "Gauche");
    	private RadioButton justC6 = new RadioButton("justification6", "Centre");
    	private ListBox couleur6 = new ListBox ();
    	private HorizontalPanel hp;
    	private Label titre;
    	private Label text;
    	private Label couleur;
    	private Label clignotement;
    	private Label justification;
     
    	public PanelMessagePage(String page){
     
    		titre = new Label ( "Page "+page);
    		text = new Label ( "Texte");
    		couleur = new Label ( "Couleur");
    		clignotement = new Label ( "Clignotement");
    		justification = new Label ( "Justification");
     
    		couleur1.setVisibleItemCount(1);
    		couleur1.addItem("Rouge");
    		couleur1.addItem("Vert");
    		couleur1.addItem("Ambre");
    		couleur1.addItem("Aleatoire");
    		couleur1.addItem("Melange");
     
    		couleur2.setVisibleItemCount(1);
    		couleur2.addItem("Rouge");
    		couleur2.addItem("Vert");
    		couleur2.addItem("Ambre");
    		couleur2.addItem("Aleatoire");
    		couleur2.addItem("Melange");
     
    		couleur3.setVisibleItemCount(1);
    		couleur3.addItem("Rouge");
    		couleur3.addItem("Vert");
    		couleur3.addItem("Ambre");
    		couleur3.addItem("Aleatoire");
    		couleur3.addItem("Melange");
     
    		couleur4.setVisibleItemCount(1);
    		couleur4.addItem("Rouge");
    		couleur4.addItem("Vert");
    		couleur4.addItem("Ambre");
    		couleur4.addItem("Aleatoire");
    		couleur4.addItem("Melange");
     
    		couleur5.setVisibleItemCount(1);
    		couleur5.addItem("Rouge");
    		couleur5.addItem("Vert");
    		couleur5.addItem("Ambre");
    		couleur5.addItem("Aleatoire");
    		couleur5.addItem("Melange");
     
    		couleur6.setVisibleItemCount(1);
    		couleur6.addItem("Rouge");
    		couleur6.addItem("Vert");
    		couleur6.addItem("Ambre");
    		couleur6.addItem("Aleatoire");
    		couleur6.addItem("Melange");
     
    		this.add(titre);
    		this.add(hp = new HorizontalPanel());
    		hp.add(text);
    		hp.add(couleur);
    		hp.add(clignotement);
    		hp.add(justification);
     
    		this.add(hp = new HorizontalPanel());
    		hp.setSpacing(8);
    		hp.add(txtLigne1);
    		hp.add(couleur1);
    	        hp.add(clTrue1);
    	        hp.add(clFalse1);
    	        hp.add(justG1);
    	        hp.add(justC1);
     
     
    	        this.add(hp = new HorizontalPanel());
    		hp.setSpacing(8);
    		hp.add(txtLigne2);
    		hp.add(couleur2);
    	        hp.add(clTrue2);
    	        hp.add(clFalse2);
    	        hp.add(justG2);
    	        hp.add(justC2);
     
    	        this.add(hp = new HorizontalPanel());
    		hp.setSpacing(8);
    		hp.add(txtLigne3);
    		hp.add(couleur3);
    	        hp.add(clTrue3);
    	        hp.add(clFalse3);
    	        hp.add(justG3);
    	        hp.add(justC3);
     
    	        this.add(hp = new HorizontalPanel());
    		hp.setSpacing(8);
    		hp.add(txtLigne4);
    		hp.add(couleur4);
    	        hp.add(clTrue4);
    	        hp.add(clFalse4);
    	        hp.add(justG4);
    	        hp.add(justC4);
     
    	        this.add(hp = new HorizontalPanel());
    		hp.setSpacing(8);
    		hp.add(txtLigne5);
    		hp.add(couleur5);
    	        hp.add(clTrue5);
    	        hp.add(clFalse5);
    	        hp.add(justG5);
    	        hp.add(justC5);
     
    	        this.add(hp = new HorizontalPanel());
    		hp.setSpacing(8);
    		hp.add(txtLigne6);
    		hp.add(couleur6);
    	        hp.add(clTrue6);
    	        hp.add(clFalse6);
    	        hp.add(justG6);
    	        hp.add(justC6);
     
    	}
    }
    Je souhaiterais que le label Texte soit en dessus de mes textebox puis couleur en dessus de mes listbox, Clignotement en dessus des deux radiobouton et pareil pour justification

  2. #2
    Membre éprouvé Avatar de Caroline76
    Profil pro
    Inscrit en
    Avril 2008
    Messages
    94
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2008
    Messages : 94
    Par défaut
    Tu peux utiliser un GridPanel et positionner tes widgets dans la grille, si c'est ce que tu veux faire.
    Sinon, si tu veux absolument des HorizontalPanel, tu peux fixer la taille des elements afin que tous les elements d'une meme colonne est la meme WIDTH.

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 56
    Par défaut
    La je viens de penser faire des panelLigne que j'ajoute sa me rend le tout plus simple, je vais essayer avec width.

    Pour ma classe Page
    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
     
    package com.gwt.client.Panel;
     
    import com.google.gwt.user.client.ui.HorizontalPanel;
    import com.google.gwt.user.client.ui.Label;
    import com.google.gwt.user.client.ui.ListBox;
    import com.google.gwt.user.client.ui.RadioButton;
    import com.google.gwt.user.client.ui.TextBox;
    import com.google.gwt.user.client.ui.VerticalPanel;
     
    public class PanelMessagePage extends VerticalPanel{
     
    	private Label titre;
    	private Label text;
    	private Label couleur;
    	private Label clignotement;
    	private Label justification;
    	private PanelLigne l1 = new PanelLigne(1);
    	private PanelLigne l2 = new PanelLigne(2);
    	private PanelLigne l3 = new PanelLigne(3);
    	private PanelLigne l4 = new PanelLigne(4);
    	private PanelLigne l5 = new PanelLigne(5);
    	private PanelLigne l6 = new PanelLigne(6);
     
    	public PanelMessagePage(String page){
     
    		titre = new Label ( "Page "+page);
    		text = new Label ( "Texte");
    		couleur = new Label ( "Couleur");
    		clignotement = new Label ( "Clignotement");
    		justification = new Label ( "Justification");
     
    		this.add(titre);
    		this.add(hp = new HorizontalPanel());
    		hp.add(text);
    		hp.add(couleur);
    		hp.add(clignotement);
    		hp.add(justification);
     
    		this.add(l1);
    		this.add(l2);
    		this.add(l3);
    		this.add(l4);
    		this.add(l5);
    		this.add(l6);
    Pour ma classe Ligne

    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
     
    package com.gwt.client.Panel;
     
    import com.google.gwt.user.client.ui.HorizontalPanel;
    import com.google.gwt.user.client.ui.ListBox;
    import com.google.gwt.user.client.ui.RadioButton;
    import com.google.gwt.user.client.ui.TextBox;
     
    public class PanelLigne extends HorizontalPanel {
     
    	private TextBox txtLigne;
    	private RadioButton clTrue;
    	private RadioButton clFalse ;
    	private RadioButton justG;
    	private RadioButton justC;
    	private ListBox couleur;
     
    	public PanelLigne(int p){
     
    		txtLigne = new TextBox();
    		clTrue = new RadioButton("clignotement"+p, "Actif");
    		clFalse = new RadioButton("clignotement"+p, "Desactivé");
    		justG = new RadioButton("justification"+p, "Gauche");
    		justC = new RadioButton("justification"+p, "Centre");
    		couleur = new ListBox ();
     
    		couleur.setVisibleItemCount(1);
    		couleur.addItem("Rouge");
    		couleur.addItem("Vert");
    		couleur.addItem("Ambre");
    		couleur.addItem("Aleatoire");
    		couleur.addItem("Melange");
     
    		this.setSpacing(8);
    		this.add(txtLigne);
    		this.add(couleur);
    		this.add(clTrue);
    		this.add(clFalse);
    		this.add(justG);
    		this.add(justC);
     
    	}
    }
    Je pense que s'est mieux comme ça

  4. #4
    Membre averti
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 56
    Par défaut
    Je n'ai pas de classes GridPanel?

  5. #5
    Membre averti
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 56
    Par défaut
    Et je ne peux pas appliquer setWidth à aucun de mes label
    aurait tu une explication?

  6. #6
    Membre averti
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 56
    Par défaut
    Je viens de comprendre c'est un grid tout cours et pas grind panel
    Tu pourrais m'éclairer comment placer les elements sur le grid?
    Merci d'avance

  7. #7
    Membre averti
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 56
    Par défaut
    C'est bon j'ai trouvé je mettais un int à la place d'un String.

Discussions similaires

  1. [XL-2010] Mettre en colonne un fichier avec plusieurs lignes
    Par petitours dans le forum Macros et VBA Excel
    Réponses: 16
    Dernier message: 06/02/2015, 21h12
  2. Comment mettre en colonne des resultats de plusieurs lignes
    Par shaun_the_sheep dans le forum Langage SQL
    Réponses: 1
    Dernier message: 28/04/2009, 11h41
  3. Mettre une colonne en couleur dans un form datasheet
    Par le lynx dans le forum Access
    Réponses: 3
    Dernier message: 24/05/2006, 16h17
  4. Mettre 2 colonnes dans un JComboBox
    Par legillou dans le forum AWT/Swing
    Réponses: 6
    Dernier message: 17/05/2006, 16h37
  5. Mettre a jour plusieurs lignes d'une table
    Par Tartenpion dans le forum Langage SQL
    Réponses: 4
    Dernier message: 17/12/2005, 18h50

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