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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
public class Monopoly extends JFrame implements WindowListener, ActionListener{
private JPanel panelGauche, panelDroit, panelBas;
private Frame ChoixJoueur = new Frame();
private Box textBar;
private Panel PanelJoueur = new Panel();
private TextField auteur = new TextField();
private TextField Joueur1 = new TextField();
private TextField Joueur2 = new TextField();
private TextField Joueur3 = new TextField();
private TextField Joueur4 = new TextField();
private TextField Joueur5 = new TextField();
private Button Play = new Button("Jouer");
private Button Exit = new Button("Exit");
private Image img = null;
public Monopoly (){
super();
monPanelDroite();
monPanelGauche();
monPanelBas();
mafenetre();
//monChoixJoueur();
}
private Panel monChoixJoueur(){
this.PanelJoueur = new Panel(new GridLayout(0,1));
PanelJoueur.add(new Label("Joueur 1"));
PanelJoueur.add(this.Joueur1);
PanelJoueur.add(new Label("Joueur 2"));
PanelJoueur.add(this.Joueur2);
PanelJoueur.add(new Label("Joueur 3"));
PanelJoueur.add(this.Joueur3);
PanelJoueur.add(new Label("Joueur 4"));
PanelJoueur.add(this.Joueur4);
PanelJoueur.add(new Label("Joueur 5"));
PanelJoueur.add(this.Joueur5);
PanelJoueur.add(new Label(""));
PanelJoueur.add(this.Play);
PanelJoueur.add(this.Exit);
this.ChoixJoueur.add(PanelJoueur);
this.ChoixJoueur.setVisible(true);
this.ChoixJoueur.setLocation(200, 50);
this.ChoixJoueur.setSize(300, 500);
this.ChoixJoueur.setTitle("Inscrivez les noms des joueurs !");
this.ChoixJoueur.setResizable(false);
this.Play.addActionListener(this);
this.Exit.addActionListener(this);
return this.PanelJoueur;
}
private JPanel monPanelBas(){
this.panelBas = new JPanel();
//this.textBar = Box.createHorizontalBox();
//this.textBar.setEnabled(false);
//this.textBar.add(this.auteur);
this.auteur.setEditable(false);
this.auteur.setLocation(0, 0);
this.auteur.setText("Réalisé par Moi");
this.panelBas.add(this.auteur);
this.panelBas.setLayout(new GridLayout(0,1));
//this.panelBas.add(this.textBar);
this.panelBas.setVisible(true);
return this.panelBas;
}
private JPanel monPanelGauche(){
this.panelGauche = new JPanel();
this.panelGauche.setBackground(java.awt.Color.BLACK);// = new MonopolyPlateau();
//this.panelGauche.setBounds(0,0,200, 600);
this.panelGauche.setVisible(true);
return this.panelGauche;
}
private JPanel monPanelDroite(){
this.panelDroit = new JPanel();
this.panelDroit.setBackground(java.awt.Color.BLUE);
//this.panelDroit.setBounds(0, 0, 600, 600);
this.panelDroit.setVisible(true);
return this.panelDroit;
}
private void mafenetre(){
this.setTitle("Monopoly V1.0"); // Son titre
this.setSize(800, 600); // Dimensionnement de la fenêtre
this.setLocationRelativeTo(null); // Centrer la fenêtre
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLayout(new BorderLayout());
this.add(this.panelGauche, BorderLayout.CENTER);
this.add(this.panelDroit, BorderLayout.LINE_END);
this.add(this.panelBas, BorderLayout.SOUTH);
this.setVisible(true);
} |
Partager