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

AWT/Swing Java Discussion :

Problème avec gridbaglayout


Sujet :

AWT/Swing Java

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2003
    Messages
    460
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2003
    Messages : 460
    Points : 112
    Points
    112
    Par défaut Problème avec gridbaglayout
    Salut !


    Je ne m'en sors définitevement pas avec le GridBagLayout...

    Voici 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
    	private JPanel getJPanel1() {
    		if (jPanel1 == null) {
    			jPanel1 = new JPanel();
    			jPanel1.setLayout(new GridBagLayout());
    			GridBagConstraints gbc = new GridBagConstraints();
    			gbc.fill = GridBagConstraints.NONE;
    			jPanel1.setPreferredSize(new Dimension(300, 210));
    			jPanel1.setBackground(Color.green);
    			gbc.anchor=GridBagConstraints.PAGE_START;
    			gbc.anchor=GridBagConstraints.LINE_START;
    			gbc.gridx = 0; gbc.gridy = 0;
    			gbc.gridwidth = 1; gbc.gridheight = 1;
    			gbc.weightx = 0; gbc.weighty = 0;
    			jtf1.setPreferredSize(new Dimension(100,20));
    			jPanel1.add(jtf1,gbc);
    			gbc.gridx = 0; gbc.gridy = 1;
    			gbc.gridwidth = 1; gbc.gridheight = 1;
    			gbc.weightx = 0; gbc.weighty = 0;
    			jtf2.setPreferredSize(new Dimension(100,20));
    			jPanel1.add(jtf2,gbc);
    			gbc.gridx = 0; gbc.gridy = 2;
    			gbc.gridwidth = 1; gbc.gridheight = 1;
    			gbc.weightx = 0; gbc.weighty = 0;
    			jtf3.setPreferredSize(new Dimension(100,20));
    			jPanel1.add(jtf3,gbc);
    			gbc.gridx = 1; gbc.gridy = 0;
    			gbc.gridwidth = 1; gbc.gridheight = 1;
    			gbc.weightx = 0; gbc.weighty = 0;
    			jlbl1.setText("Total");
    			jPanel1.add(jlbl1,gbc);
    			gbc.gridx = 1; gbc.gridy = 1;
    			gbc.gridwidth = 1; gbc.gridheight = 1;
    			gbc.weightx = 0; gbc.weighty = 0;
    			jlbl2.setText("Mise");
    			jPanel1.add(jlbl2,gbc);
    			gbc.gridx = 1; gbc.gridy = 2;
    			gbc.gridwidth = 1; gbc.gridheight = 1;
    			gbc.weightx = 0; gbc.weighty = 0;
    			jlbl3.setText("Gain");
    			jPanel1.add(jlbl3,gbc);			
    		}
    		return jPanel1;
    	}
    Tel que c'est là, mes 6 composants sont centrés au milieu de mon panel. Comment faire pour qu'ils se situent en haut à gauche ?

    Merci !

  2. #2
    Expert éminent sénior
    Avatar de Baptiste Wicht
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2005
    Messages
    7 431
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2005
    Messages : 7 431
    Points : 21 324
    Points
    21 324
    Par défaut
    Ce serait plus simple avec un screenshot.

    Mais à mon avis, il faut que tu définisses une politique de redimenssionnement en mettant les weightx et les weighty à 1.0 sur les composants qui doivent prendre la place.

    En plus, de cela, il faut également dire quels composants sont les derniers de leur ligne/colonne en mettant gridwith (gridheight) à 0 (REMAINDER).

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2003
    Messages
    460
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2003
    Messages : 460
    Points : 112
    Points
    112
    Par défaut
    Voilà un screenshot :


  4. #4
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2003
    Messages
    460
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2003
    Messages : 460
    Points : 112
    Points
    112
    Par défaut
    Citation Envoyé par Baptiste Wicht Voir le message
    sur les composants qui doivent prendre la place.
    Qu'entends-tu par là ?

  5. #5
    Expert éminent sénior
    Avatar de Baptiste Wicht
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2005
    Messages
    7 431
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2005
    Messages : 7 431
    Points : 21 324
    Points
    21 324
    Par défaut
    Citation Envoyé par Mike888 Voir le message
    Qu'entends-tu par là ?
    En fait, il faut que la place soit occuppé par des composants, sinon, elle est reparti et cela résulte en une interface entièrement centrée.

    Il faut donc que tes labels occuppent toute la largeur (weightx = 1.0, gridwith = 0) et que ton dernier textfield et ton dernier label occuppe toute la place en hauteur (weighty = 1.0 et gridheight = 0). Si tu laisse fill à NONE, cela va juste dire à GridBagLayout de donner toute la taille à ces composants sans les redimensionner.

  6. #6
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2003
    Messages
    460
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2003
    Messages : 460
    Points : 112
    Points
    112
    Par défaut
    Ca marche pour les 2 premiers (en haut et à gauche), mais le troisième reste au milieu de la hauteur... Bizarre, non ?...

  7. #7
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2003
    Messages
    460
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2003
    Messages : 460
    Points : 112
    Points
    112
    Par défaut

  8. #8
    Expert éminent sénior
    Avatar de Baptiste Wicht
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2005
    Messages
    7 431
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2005
    Messages : 7 431
    Points : 21 324
    Points
    21 324
    Par défaut
    Cette fois, il faut que tu joues avec les anchor. Regarde du coté de FIRST_LINE_START et autres

  9. #9
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2003
    Messages
    460
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2003
    Messages : 460
    Points : 112
    Points
    112
    Par défaut
    C'est ok ! Merci à toi.


    Code final :

    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
    	private JPanel getJPanel1() {
    		if (jPanel1 == null) {
    			jPanel1 = new JPanel();
    			jPanel1.setLayout(new GridBagLayout());
    			GridBagConstraints gbc = new GridBagConstraints();
    			gbc.fill = GridBagConstraints.NONE;
    			jPanel1.setPreferredSize(new Dimension(300, 210));
    			jPanel1.setBackground(Color.green);		
    			gbc.gridx = 0; gbc.gridy = 0;
    			gbc.gridwidth = 1; gbc.gridheight = 1;
    			gbc.weightx = 0.1; gbc.weighty = 0;
    			jtf1.setPreferredSize(new Dimension(100,20));
    			jPanel1.add(jtf1,gbc);			
    			gbc.gridx = 0; gbc.gridy = 1;
    			gbc.gridwidth = 1; gbc.gridheight = 1;
    			gbc.weightx = 0.1; gbc.weighty = 0;
    			jtf2.setPreferredSize(new Dimension(100,20));
    			jPanel1.add(jtf2,gbc);
    			gbc.gridx = 0; gbc.gridy = 2;
    			gbc.gridwidth = 1; gbc.gridheight = 0;
    			gbc.weightx = 0.1; gbc.weighty = 1;
    			gbc.gridheight=GridBagConstraints.REMAINDER;
    			gbc.anchor=GridBagConstraints.PAGE_START;
    			jtf3.setPreferredSize(new Dimension(100,20));
    			jPanel1.add(jtf3,gbc);
    			gbc.gridx = 1; gbc.gridy = 0;
    			gbc.gridwidth = 0; gbc.gridheight = 1;
    			gbc.weightx = 0.9; gbc.weighty = 0;
    			gbc.ipadx=120;
    			gbc.gridwidth=GridBagConstraints.REMAINDER;
    			jlbl1.setText("Total");
    			jPanel1.add(jlbl1,gbc);
    			gbc.gridx = 1; gbc.gridy = 1;
    			gbc.gridwidth = 0; gbc.gridheight = 1;
    			gbc.weightx = 0.9; gbc.weighty = 0;
    			gbc.ipadx=120;
    			jlbl2.setText("Mise");
    			jPanel1.add(jlbl2,gbc);
    			gbc.gridx = 1; gbc.gridy = 2;
    			gbc.gridwidth = 0; gbc.gridheight = 0;
    			gbc.weightx = 0.9; gbc.weighty = 1;
    			gbc.ipadx=120;
    			jlbl3.setText("Gain");
    			jPanel1.add(jlbl3,gbc);			
    		}
    		return jPanel1;
    	}

  10. #10
    Expert éminent sénior
    Avatar de Baptiste Wicht
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2005
    Messages
    7 431
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2005
    Messages : 7 431
    Points : 21 324
    Points
    21 324
    Par défaut
    Juste une chose pour simplifier ton code, ne met à jour que les variables de gbc qui change entre 2 composants et pas toutes les variables à chaque fois, c'est plus clair

    Par exemple :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    gbc.gridx = 0; gbc.gridy = 0;
    gbc.gridwidth = 1; gbc.gridheight = 1;
    gbc.weightx = 0.1; gbc.weighty = 0;
    jtf1.setPreferredSize(new Dimension(100,20));
    jPanel1.add(jtf1,gbc);			
    gbc.gridx = 0; gbc.gridy = 1;
    gbc.gridwidth = 1; gbc.gridheight = 1;
    gbc.weightx = 0.1; gbc.weighty = 0;
    jtf2.setPreferredSize(new Dimension(100,20));
    jPanel1.add(jtf2,gbc);
    Devient :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    gbc.gridx = 0; gbc.gridy = 0;
    gbc.gridwidth = 1; gbc.gridheight = 1;
    gbc.weightx = 0.1; gbc.weighty = 0;
    jtf1.setPreferredSize(new Dimension(100,20));
    jPanel1.add(jtf1,gbc);			
    gbc.gridy = 1;
    jtf2.setPreferredSize(new Dimension(100,20));
    jPanel1.add(jtf2,gbc);
    Ou alors, tu peux créer une méthode utiliser qui va te modifier ton objet gbc pour faire encore plus propre.

  11. #11
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    171
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Avril 2007
    Messages : 171
    Points : 163
    Points
    163
    Par défaut
    Dans un projet, j'ai fait :

    int XCouleur [] = {
    10, 10, 12, 14, 16, 18, 22, 26, 30, 34,
    38, 42, 46, 50, 54, 58, 62, 64, 66, 68,
    68, 68, 66, 64, 62, 58, 54, 50, 46, 42,
    38, 34, 30, 26, 22, 18, 16, 14, 12, 10};

    int YCouleur [] = {
    24, 22, 20, 18, 16, 14, 12, 10, 10, 8,
    8, 8, 10, 10, 12, 14, 16, 18, 20, 22,
    24, 26, 28, 30, 32, 34, 36, 38, 38, 40,
    40, 40, 38, 38, 36, 34, 32, 30, 28, 26};
    puis :

    GBC.fill = GBC.BOTH;
    for (int i = 0; i<40; i++){
    BoutonCouleur[i] = new JButton();
    BoutonCouleur[i].setPreferredSize(new Dimension(10,10));
    GBC.gridx = (XCouleur[i]-4); GBC.gridy = YCouleur[i];
    GBC.gridwidth = 4; GBC.gridheight = 2;
    GBC.weightx = 1; GBC.weighty = 1;
    Contenu.add (BoutonCouleur[i], GBC);
    }
    Inséré dans un JPanel, lui-même inclus dans la fenêtre principale, cela permet de placer librement ses boutons.

  12. #12
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2003
    Messages
    460
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2003
    Messages : 460
    Points : 112
    Points
    112
    Par défaut
    J'ai encore besoin de vous...

    Voilà, je veux rajouter 2 JButton, et ça ne va pas comme je le désire...
    1°) Les Jtextfield ont été réduits au strict minimum sur la gauche;
    2°) Les 2 boutons sont trop larges, je voudrais les rapetisser.




    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
    private JPanel getJPanel1() {
    		if (jPanel1 == null) {
    			jPanel1 = new JPanel();
    			jPanel1.setLayout(new GridBagLayout());
    			GridBagConstraints gbc = new GridBagConstraints();
    			gbc.fill = GridBagConstraints.NONE;
    			jPanel1.setPreferredSize(new Dimension(300, 300));
    			jPanel1.setBackground(Color.LIGHT_GRAY);		
     
    			gbc.gridx = 0; gbc.gridy = 0;
    			gbc.gridwidth = 1; gbc.gridheight = 1;
    			gbc.weightx = 0; gbc.weighty = 0;
    			jtf1.setHorizontalAlignment(JTextField.RIGHT);
    			jtf1.setPreferredSize(new Dimension(100,20));
    			jPanel1.add(jtf1,gbc);			
     
    			gbc.gridx = 0; gbc.gridy = 1;
    			gbc.weightx = 0; gbc.weighty = 0;
    			jtf2.setHorizontalAlignment(JTextField.RIGHT);
    			jtf2.setPreferredSize(new Dimension(100,20));
    			jPanel1.add(jtf2,gbc);
     
    			gbc.gridx = 0; gbc.gridy = 2;			
    			gbc.weightx = 0; gbc.weighty = 1;
    			gbc.anchor=GridBagConstraints.PAGE_START;
    //			gbc.gridheight=GridBagConstraints.REMAINDER;
    			jtf3.setHorizontalAlignment(JTextField.RIGHT);
    			jtf3.setPreferredSize(new Dimension(100,20));
    			jPanel1.add(jtf3,gbc);
     
    			gbc.gridx = 1; gbc.gridy = 0;			
    			gbc.weightx = 0.4; gbc.weighty = 0;
    			gbc.ipadx=120;
    			gbc.gridwidth=GridBagConstraints.REMAINDER;
    			jlbl1.setText("Total");
    			jPanel1.add(jlbl1,gbc);
     
    			gbc.gridx = 1; gbc.gridy = 1;			
    			gbc.weightx = 0.4; gbc.weighty = 0;		
    			jlbl2.setText("Mise");
    			jPanel1.add(jlbl2,gbc);
     
    			gbc.gridx = 1; gbc.gridy = 2;			
    			gbc.weightx = 0.4; gbc.weighty = 1;			
    			jlbl3.setText("Gain");
    			jPanel1.add(jlbl3,gbc);
     
    			gbc.gridx = 1; gbc.gridy = 3;			
    			gbc.weightx = 0.4; gbc.weighty = 1;	
    			jb7.setText("Mettre 0.5€ dans le Bingo");
    			MouseListener buttonListener = new MouseAdapter(){
    				public void mouseClicked(MouseEvent ev) {
    					JButton obj = (JButton)ev.getSource();
    					if (obj.getActionCommand().startsWith("jb7")) {
    						if (SwingUtilities.isLeftMouseButton(ev) || ev.isPopupTrigger()){
    							bingomodele.setTotal(bingomodele.getTotal()+0.5);
    						}
    					}					
    				}
    			};
    			jb7.setActionCommand("jb7");
    			jb7.addMouseListener(buttonListener);
    			jPanel1.add(jb7,gbc);
     
    			gbc.gridx = 1; gbc.gridy = 4;			
    			gbc.weightx = 0.4; gbc.weighty = 1;	
    			gbc.gridheight=GridBagConstraints.REMAINDER;
    			jb8.setText("Miser 0.5€");
    			jb8.setPreferredSize(new Dimension(60,20));
    			jPanel1.add(jb8,gbc);

    Si vous voyez ce qui peut clocher parce que moi, j'abandonne

  13. #13
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2003
    Messages
    460
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2003
    Messages : 460
    Points : 112
    Points
    112
    Par défaut
    Ca avance un peu :


  14. #14
    Membre régulier
    Profil pro
    Inscrit en
    Décembre 2003
    Messages
    460
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2003
    Messages : 460
    Points : 112
    Points
    112
    Par défaut
    Bon, manque plus qu'un tout petit qqch...

    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
    	private JPanel getJPanel1() {
    		if (jPanel1 == null) {
    			jPanel1 = new JPanel();
    			jPanel1.setLayout(new GridBagLayout());
    			GridBagConstraints gbc = new GridBagConstraints();
    			gbc.fill = GridBagConstraints.NONE;
    			jPanel1.setPreferredSize(new Dimension(300, 300));
    			jPanel1.setBackground(Color.LIGHT_GRAY);		
     
    			gbc.gridx = 0; gbc.gridy = 0;
    			gbc.gridwidth = 1; gbc.gridheight = 1;
    			gbc.weightx = 0; gbc.weighty = 0;
    			jtf1.setHorizontalAlignment(JTextField.RIGHT);
    			jtf1.setPreferredSize(new Dimension(100,20));
    			jPanel1.add(jtf1,gbc);			
     
    			gbc.gridx = 0; gbc.gridy = 1;
    			gbc.weightx = 0; gbc.weighty = 0;
    			jtf2.setHorizontalAlignment(JTextField.RIGHT);
    			jtf2.setPreferredSize(new Dimension(100,20));
    			jPanel1.add(jtf2,gbc);
     
    			gbc.gridx = 0; gbc.gridy = 2;			
    			gbc.weightx = 0; gbc.weighty = 1;
    			gbc.anchor=GridBagConstraints.PAGE_START;
    			gbc.gridheight=GridBagConstraints.REMAINDER;
    			jtf3.setHorizontalAlignment(JTextField.RIGHT);
    			jtf3.setPreferredSize(new Dimension(100,20));
    			jPanel1.add(jtf3,gbc);
     
    			gbc.gridx = 1; gbc.gridy = 0;	
    			gbc.gridwidth = 0; gbc.gridheight = 0;
    			gbc.weightx = 1; gbc.weighty = 0;
    			gbc.ipadx=120;
    			jlbl1.setText("Total");
    			jPanel1.add(jlbl1,gbc);
     
    			gbc.gridx = 1; gbc.gridy = 1;
    			gbc.gridwidth = 0; gbc.gridheight = 0;
    			gbc.weightx = 1; gbc.weighty = 0;		
    			jlbl2.setText("Mise");
    			jPanel1.add(jlbl2,gbc);
     
    			gbc.gridx = 1; gbc.gridy = 2;	
    			gbc.gridwidth = 0; gbc.gridheight = 1;
    			gbc.weightx = 1; gbc.weighty = 0;			
    			jlbl3.setText("Gain");
    			jPanel1.add(jlbl3,gbc);
     
    			gbc.gridx = 1; gbc.gridy = 3;			
    			gbc.weightx = 1; gbc.weighty = 0.5;	
    			gbc.ipadx=0;
    			jb7.setText("Mettre 0.5€ dans le Bingo");
    			MouseListener buttonListener = new MouseAdapter(){
    				public void mouseClicked(MouseEvent ev) {
    					JButton obj = (JButton)ev.getSource();
    					if (obj.getActionCommand().startsWith("jb7")) {
    						if (SwingUtilities.isLeftMouseButton(ev) || ev.isPopupTrigger()){
    							bingomodele.setTotal(bingomodele.getTotal()+0.5);
    						}
    					}					
    				}
    			};
    			jb7.setActionCommand("jb7");
    			jb7.addMouseListener(buttonListener);
    			jPanel1.add(jb7,gbc);
     
    			gbc.gridx = 2; gbc.gridy = 4;			
    			gbc.weightx = 1; gbc.weighty = .5;	
    			gbc.gridheight=GridBagConstraints.REMAINDER;
    			jb8.setText("Miser 0.5€");		
    			MouseListener buttonListener1 = new MouseAdapter(){
    				public void mouseClicked(MouseEvent ev) {
    					JButton obj = (JButton)ev.getSource();
    					if (obj.getActionCommand().startsWith("jb8")) {
    						if (SwingUtilities.isLeftMouseButton(ev) || ev.isPopupTrigger()){
    							if (bingomodele.getTotal()>0) {
    							bingomodele.setMise(bingomodele.getMise()+0.5);
    							bingomodele.setTotal(bingomodele.getTotal()-0.5);
    							}
    						}
    					}					
    				}
    			};
    			jb8.setActionCommand("jb8");
    			jb8.addMouseListener(buttonListener1);
    			jPanel1.add(jb8,gbc);
    		}
    		return jPanel1;
    	}


    Je voudrais que le bouton "mettre..." descende juste au-dessus de l'autre !

Discussions similaires

  1. Problème avec GridBagLayout
    Par JeremGamer dans le forum Agents de placement/Fenêtres
    Réponses: 13
    Dernier message: 30/09/2013, 15h43
  2. Problème avec GridBagLayout
    Par Benduroy dans le forum Interfaces Graphiques en Java
    Réponses: 4
    Dernier message: 01/06/2011, 07h44
  3. Problème avec GridBagLayout
    Par alexis0587 dans le forum Agents de placement/Fenêtres
    Réponses: 6
    Dernier message: 25/03/2009, 22h57
  4. Problème avec GridBagLayout dans JPanel
    Par caneman dans le forum AWT/Swing
    Réponses: 4
    Dernier message: 19/12/2006, 22h32
  5. [Swing] Problème avec les GridBagLayout
    Par CrazySeb dans le forum AWT/Swing
    Réponses: 1
    Dernier message: 28/04/2006, 14h47

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