Bonsoir,
j'ai codé une application utilisant le gridBagLayout et j'ai apparement un problème de poids.
J'ai un composant qui prend plus de place que je lui en ai "fourni".Ci-joint deux screen qui montre mon problème:-Le premier montre l'application tel quelle est actuellement-Le second tel que je la veuxDans le deuxieme, j'ai enlever tous les composant que j'ajoutais à mon panel en bas à gauche.Et là il occupe bien la place que je veux. Apparemment ça dois etre lié au bouton qui sont pas redimensionner.
Le code de mon panel en bas à gauche
Le code de mon panel principal:
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 setBackground(Color.DARK_GRAY); setLayout(new GridBagLayout()); GBC gbcScoreNom = new GBC(0,0,1,1).setWeight(7, 1) .setFill(GBC.BOTH).setInsets(10); GBC gbcChevalet = new GBC(0,1,1,2).setWeight(7, 1) .setFill(GBC.BOTH).setInsets(0,10,10,10); GBC gbcPanelJocker = new GBC(1,0,2,1).setWeight(1, 1) .setFill(GBC.BOTH).setInsets(10, 0,10,10); GBC gbcBoutonJocker = new GBC(1,1,1,1).setWeight(1, 0).setInsets(30,0,0,0); GBC gbcBoutonPiocher = new GBC(2,1,1,1).setWeight(1, 0).setInsets(30,0,0,0); GBC gbcBoutonEchanger = new GBC(2,2,1,1).setWeight(1, 0).setInsets(0,0,0,0); GBC gbcBoutonFinTour = new GBC(1,2,1,1).setWeight(1, 0).setInsets(0,0,0,0); this.scorePanel = new TextPanel(); this.chevaletView = new RackView(); this.panelJocker = new JockerPanel(); this.boutonJocker = new RoundButton("Jocker",this); this.boutonPiocher = new RoundButton("Piocher",this); this.boutonEchanger = new RoundButton("Echanger",this); this.boutonFinTour = new RoundButton("Fin du tour",this); //this.add(scorePanel,gbcScoreNom); //this.add(chevaletView,gbcChevalet); //this.add(panelJocker, gbcPanelJocker); //this.add(boutonJocker, gbcBoutonJocker); //this.add(boutonPiocher, gbcBoutonPiocher); //this.add(boutonEchanger, gbcBoutonEchanger); //this.add(boutonFinTour, gbcBoutonFinTour); boutonJocker.setEnabled(false); boutonPiocher.setEnabled(false); boutonEchanger.setEnabled(false); boutonFinTour.setEnabled(false);Si quelqu'un arrive à comprendre mon problème je l'en remerci d'avance
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 this.controller = controller; this.model = model; this.actionPanel = new ActionPanel(); this.infoPanel = new StatistiquePanel(); Board board = model.getBoard(); this.boardView = new BoardView(board); board.addObserver(boardView); this.laPiochePanel = new PiochePanel(); this.setLayout(new GridBagLayout()); GBC gbcAction = new GBC(0, 1, 2,1).setWeight(0, 1).setFill(GBC.BOTH); GBC gbcPioche = new GBC(0, 0, 1,1).setWeight(3, 3).setFill(GBC.BOTH); GBC gbcPlateau = new GBC(1, 0, 1,1).setWeight(7, 3).setFill(GBC.BOTH); GBC gbc1nfo = new GBC(2, 0, 1,2).setWeight(4, 1).setFill(GBC.BOTH); this.add(infoPanel, gbc1nfo); this.add(laPiochePanel,gbcPioche); this.add(boardView,gbcPlateau); this.add(actionPanel,gbcAction);
Partager