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
|
//création éléments
jListMCAE = new JList(lstMCAE);
jListMCAD = new JList(lstMCAD);
jScrollMCAE = new JScrollPane();
jScrollMCAD = new JScrollPane();
jScrollMCAE.getViewport().add(jListMCAE);
jScrollMCAD.getViewport().add(jListMCAD);
jBAddAboMsg = new JButton();
jBSuppAbo = new JButton();
//positionnement
jPanelMCG.add(jLabelMCAD, BorderLayout.NORTH);
jPanelMCG.add(jScrollMCAD, BorderLayout.CENTER);
jPanelMCD.add(jLabelMCAE, BorderLayout.NORTH);
jPanelMCD.add(jScrollMCAE, BorderLayout.CENTER);
jPanelMCC.setPreferredSize(new Dimension(120, 12));
jPanelMCC.setMinimumSize(new Dimension(120, 12));
jPanelMCC.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = GridBagConstraints.RELATIVE;
gbc.gridx = 0;
jPanelMCC.add(jBAddAboMsg, gbc);
jPanelMCC.add(new JLabel("\n"), gbc);
jPanelMCC.add(new JLabel("\n"), gbc);
jPanelMCC.add(jBSuppAbo, gbc);
gbc = new GridBagConstraints();
gbc.gridx = GridBagConstraints.RELATIVE; //incremente la colonne tout seul
gbc.gridy = GridBagConstraints.REMAINDER; //tjs sur la meme ligne
gbc.weighty = 1.0; //100% du y
gbc.weightx = 0.5; // 50% du x
gbc.fill = GridBagConstraints.BOTH; //etirable en x et en y
jPanelMCCentre.add(jPanelMCG, gbc);
gbc.weightx = 0.0; //taille fixe
gbc.fill = GridBagConstraints.VERTICAL; //etirable en y
jPanelMCCentre.add(jPanelMCC, gbc);
gbc.weightx = 0.5;
gbc.fill = GridBagConstraints.BOTH;
jPanelMCCentre.add(jPanelMCD, gbc); |
Partager