Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider a95f6505 rédigé par Jocelyn MASSEROT's avatar Jocelyn MASSEROT
Parcourir les fichiers

Jocelyn - Mise en page Menu Partie

parent fb63bafa
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Aucun aperçu pour ce type de fichier
Aucun aperçu pour ce type de fichier
Aucun aperçu pour ce type de fichier
Aucun aperçu pour ce type de fichier
Aucun aperçu pour ce type de fichier
......@@ -2,6 +2,7 @@ package vues;
import info1.network.Player;
import javax.swing.ImageIcon;
import javax.swing.*;
import javax.swing.border.LineBorder;
......@@ -20,7 +21,7 @@ public class MenuPartie extends JFrame{
private JTextField zoneID;
private JPanel middle2;
private JPanel middle2_1;
private JPanel nord;
private JPanel id;
private JPanel gifid;
private JLabel message2;
......@@ -28,49 +29,61 @@ public class MenuPartie extends JFrame{
private JButton btJoin;
private JPanel title;
private JPanel idpartie;
private JPanel create;
//private JPanel create;
private JPanel join;
public MenuPartie(String Titre) throws MalformedURLException {
super(Titre);
Vue2 = new JPanel(new BorderLayout());
middle2 = new JPanel(new BorderLayout());
btCreate = new JButton("Créer une partie");
btCreate.setPreferredSize(new Dimension(50, 80));
middle2_1 = new JPanel();
nord = new JPanel(new GridLayout(2,1));
zoneID = new JTextField("");
zoneID.setColumns(15);
idpartie = new JPanel(new FlowLayout());
LineBorder linedBorder2 = new LineBorder(Color.BLACK);
TitledBorder titledBorder2 = BorderFactory.createTitledBorder(linedBorder2,"Veuillez rentrer l'ID de la partie");
titledBorder2.setTitleJustification(TitledBorder.CENTER);
idpartie.setBorder(titledBorder2);
zoneID = new JTextField("");
zoneID.setColumns(40);
zoneID.setColumns(20);
btJoin = new JButton("Rejoindre une partie");
btJoin.setEnabled(true);
btJoin.setPreferredSize(new Dimension(200, 18));
idpartie.add(zoneID);
idpartie.add(btJoin);
nord.add(idpartie);
URL url = new URL("https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/18cbd457-20c3-4594-9610-159e275fbf7e/d4uw587-c42016e4-3b97-493f-a398-0ee53afa44a9.gif?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwic3ViIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsImF1ZCI6WyJ1cm46c2VydmljZTpmaWxlLmRvd25sb2FkIl0sIm9iaiI6W1t7InBhdGgiOiIvZi8xOGNiZDQ1Ny0yMGMzLTQ1OTQtOTYxMC0xNTllMjc1ZmJmN2UvZDR1dzU4Ny1jNDIwMTZlNC0zYjk3LTQ5M2YtYTM5OC0wZWU1M2FmYTQ0YTkuZ2lmIn1dXX0.Z-AjB9O00-feeJGFI0hawJbqqbv7F1qc1vdm3xRIApo");
Icon icon = new ImageIcon(url);
JLabel label = new JLabel(icon);
create = new JPanel(new FlowLayout());
LineBorder linedBorder3 = new LineBorder(Color.BLACK);
TitledBorder titledBorder3 = BorderFactory.createTitledBorder(linedBorder3,"Vous pouvez rejoindre une partie avec son ID ou en créer une");
titledBorder3.setTitleJustification(TitledBorder.CENTER);
nord.setBorder(titledBorder3);
btCreate = new JButton("Créer une partie");
btCreate.setEnabled(true);
btCreate.setPreferredSize(new Dimension(400, 18));
create.add(btCreate);
nord.add(create);
gifid = new JPanel(new BorderLayout());
gifid.add(idpartie, BorderLayout.NORTH);
gifid.add(nord, BorderLayout.NORTH);
JPanel BorderGif = new JPanel(new BorderLayout());
BorderGif.add(label);
BorderGif.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10));
gifid.add(BorderGif);
middle2_1.add(gifid, BorderLayout.CENTER);
gifid.add(BorderGif, BorderLayout.CENTER);
middle2.add(gifid, BorderLayout.CENTER);
// middle2.add(create, BorderLayout.SOUTH);
middle2.add(middle2_1, BorderLayout.CENTER);
middle2.add(btCreate, BorderLayout.NORTH);
//middle2.add(middle2_1, BorderLayout.CENTER);
//middle2.add(btCreate, BorderLayout.SOUTH);
title = new JPanel(new BorderLayout());
......@@ -83,7 +96,7 @@ public class MenuPartie extends JFrame{
Vue2.add(middle2, BorderLayout.CENTER);
this.setContentPane(Vue2);
this.setPreferredSize(new Dimension(1000, 650));
this.setPreferredSize(new Dimension(1000, 500));
this.pack();
this.setLocationRelativeTo(null);
this.setResizable(false);
......@@ -102,6 +115,7 @@ public class MenuPartie extends JFrame{
public void ListenerBoutonJoin(ActionListener action){
btJoin.addActionListener(action);
}
public void ListenerBoutonCreate(ActionListener action){
btCreate.addActionListener(action);
}
......@@ -109,6 +123,11 @@ public class MenuPartie extends JFrame{
public String checkID(){
return zoneID.getText();
}
public int DonneID(){
return Integer.parseInt(zoneID.getText());
}
public int donneId(){
return Integer.parseInt(zoneID.getText());
}
......@@ -116,6 +135,7 @@ public class MenuPartie extends JFrame{
public void setPlayerVues(Player leplayer){
this.player= leplayer;
}
public Player getPlayerVues(){
return this.player;
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter