Untitled
unknown
plain_text
4 years ago
4.4 kB
7
Indexable
package dz.gafmoai.mpihm.ui; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextArea; import javax.swing.JTextField; public class SaisieMembre extends JFrame { private static final long serialVersionUID = 1L; private JPanel jpContenu; private JPanel jpSaisieInfo; private JPanel jpSaisieInfoNorth; private JPanel jpSaisieInfoCenter; private JPanel jpSaisieInfoSouth; private JPanel jpCaseChoix; private JPanel jpBoutons; private JCheckBox[] cbTableau; private JLabel lNom; private JLabel lPrenom; private JLabel lAdresse; private JLabel lSexe; private JTextField tfNom; private JTextField tfPrenom; private JTextArea taAdresse; private JRadioButton cbHomme; private JRadioButton cbFemme; private JButton bOK, bAnnuler; public SaisieMembre() { this.initFenetre(); this.initJPContenu(); this.initJPSaisieInfo(); this.initJPCaseChoix(); this.initJPBoutons(); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); } private void initFenetre() { this.setTitle("Boîte de saisie"); this.setDefaultCloseOperation(EXIT_ON_CLOSE); } private void initJPContenu() { this.jpContenu = new JPanel(); this.jpContenu.setLayout(new BorderLayout()); this.add(jpContenu, BorderLayout.CENTER); } private void initJPSaisieInfo() { this.jpSaisieInfo = new JPanel(); this.jpSaisieInfoNorth = new JPanel(); this.jpSaisieInfoCenter = new JPanel(); this.jpSaisieInfoSouth = new JPanel(); this.jpSaisieInfo.setLayout(new BorderLayout()); // jpSaisieInfoNorth final int nbColonne = 1; final int nbLigne = 5; this.lNom = new JLabel("Nom :"); this.lPrenom = new JLabel("Prénom :"); this.lAdresse = new JLabel("Adresse :"); this.tfNom = new JTextField(); this.tfPrenom = new JTextField(); this.jpSaisieInfoNorth.setLayout(new GridLayout(nbLigne, nbColonne)); this.jpSaisieInfoNorth.add(this.lNom); this.jpSaisieInfoNorth.add(this.tfNom); this.jpSaisieInfoNorth.add(this.lPrenom); this.jpSaisieInfoNorth.add(this.tfPrenom); this.jpSaisieInfoNorth.add(this.lAdresse); this.jpSaisieInfo.add(this.jpSaisieInfoNorth, BorderLayout.NORTH); // jpSaisieInfoCenter this.jpSaisieInfoCenter = new JPanel(); this.jpSaisieInfoCenter.setLayout(new BorderLayout()); this.taAdresse = new JTextArea(); this.jpSaisieInfoCenter.add(taAdresse); this.jpSaisieInfo.add(jpSaisieInfoCenter, BorderLayout.CENTER); // jpSaisieInfoSouth this.jpSaisieInfoSouth = new JPanel(); this.jpSaisieInfoSouth.setLayout(new FlowLayout()); this.lSexe = new JLabel("Sexe "); this.cbHomme = new JRadioButton("Homme"); this.cbFemme = new JRadioButton("Femme"); this.jpSaisieInfoSouth.add(lSexe); this.jpSaisieInfoSouth.add(cbHomme); this.jpSaisieInfoSouth.add(cbFemme); this.jpSaisieInfo.add(this.jpSaisieInfoSouth, BorderLayout.SOUTH); this.jpContenu.add(this.jpSaisieInfo, BorderLayout.WEST); } private void initJPCaseChoix() { final int nbColonne = 1; final int nbLigne = 9; final String[] strCases = {"Tennis", "Squash", "Natation", "Athlétisme", "Randonnée", "Foot", "Basket", "Volley", "Petanque"}; this.jpCaseChoix = new JPanel(); this.jpCaseChoix.setLayout(new GridLayout(nbLigne, nbColonne)); this.cbTableau = new JCheckBox[nbLigne]; for (int i = 0; i < nbLigne; i++) { this.cbTableau[i] = new JCheckBox(strCases[i]); this.jpCaseChoix.add(this.cbTableau[i]); } this.jpContenu.add(this.jpCaseChoix, BorderLayout.EAST); } private void initJPBoutons() { final int bLargeur = 90; final int bHauteur = 25; this.jpBoutons = new JPanel(); this.setLayout(new FlowLayout()); this.bOK = new JButton("OK"); this.bOK.setPreferredSize(new Dimension(bLargeur, bHauteur)); this.bAnnuler = new JButton("Annuler"); this.bAnnuler.setPreferredSize(new Dimension(bLargeur, bHauteur)); this.jpBoutons.add(bOK); this.jpBoutons.add(bAnnuler); this.jpContenu.add(this.jpBoutons, BorderLayout.SOUTH); } public static void main(String[] args) { new SaisieMembre(); } }
Editor is loading...