Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mastermind;
- import java.awt.BorderLayout;
- import java.awt.FlowLayout;
- import java.awt.GridLayout;
- import javax.swing.JButton;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- import javax.swing.JTextField;
- import javax.swing.SwingConstants;
- public class VueMastermind extends JPanel {
- public VueMastermind()
- {
- this.setLayout(new BorderLayout());
- //Partie haute de l'interface
- {
- JPanel haut = new JPanel();
- haut.setLayout(new FlowLayout());
- JLabel label_couleurs = new JLabel("Couleurs: ");
- haut.add(label_couleurs);
- //Boutons de la partie haute de l'interface
- {
- JPanel hautBoutons = new JPanel();
- hautBoutons.setLayout(new GridLayout(1, 6));
- for(int i=0; i<6; i++)
- {
- hautBoutons.add(new JButton());
- }
- haut.add(hautBoutons);
- }
- this.add(haut, BorderLayout.NORTH);
- }
- //Milieu de l'interface
- {
- JPanel milieu = new JPanel();
- milieu.setLayout(new GridLayout(10, 2));
- //Boucle de lignes
- for(int i = 0; i<10; i++)
- {
- //Boutons
- {
- JPanel btns = new JPanel();
- btns.setLayout(new GridLayout(1, 4));
- for(int j=0; j<4; j++)
- {
- btns.add(new JButton());
- }
- milieu.add(btns);
- }
- //Compteurs
- {
- JPanel cmpts = new JPanel();
- cmpts.setLayout(new GridLayout(2, 2));
- //Labels
- {
- JLabel tmp;
- tmp = new JLabel("BP");
- tmp.setHorizontalAlignment(SwingConstants.CENTER);
- cmpts.add(tmp);
- tmp = new JLabel("MP");
- tmp.setHorizontalAlignment(SwingConstants.CENTER);
- cmpts.add(tmp);
- }
- //Champs de texte
- {
- for(int j=0; j<2; j++)
- {
- JTextField tmp = new JTextField();
- tmp.setEditable(false);
- cmpts.add(tmp);
- }
- }
- milieu.add(cmpts);
- }
- }
- this.add(milieu, BorderLayout.CENTER);
- }
- //Partie basse de l'interface
- {
- JPanel bas = new JPanel();
- bas.setLayout(new GridLayout(1, 2));
- //Partie boutons
- {
- JPanel btns = new JPanel();
- btns.setLayout(new GridLayout(1, 4));
- for(int i=0; i<4; i++)
- {
- btns.add(new JButton());
- }
- bas.add(btns);
- }
- //Partie Valider
- {
- bas.add(new JButton("Valider"));
- }
- this.add(bas, BorderLayout.SOUTH);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement