Commit af7043fe authored by Noah SIGOIGNE's avatar Noah SIGOIGNE
Browse files

modification de OptPartie

parent f624bae8
package info1.Vue;
import com.mashape.unirest.http.exceptions.UnirestException;
import info1.application.appli;
import info1.network.Game;
import info1.network.Network;
import javax.swing.*;
import java.awt.*;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class OptPartie extends JPanel {
/*______Composant pour la fenetre CreerPartie______*/
JRadioButton vFr = new JRadioButton("version Française", true);
JRadioButton vBe = new JRadioButton("version Belge", false);
private JRadioButton vFr;
private JRadioButton vBe;
JCheckBox custom = new JCheckBox("partie customisée (non fonctionnel)", false);
JCheckBox tirRepete = new JCheckBox("tir répété", false);
JCheckBox grosTir = new JCheckBox("tir amélioré", false);
private JCheckBox custom;
private JCheckBox tirRepete;
private JCheckBox grosTir;
JButton creerPartie = new JButton("Créer la partie");
JPanel optCarry = new JPanel();
private JButton creerPartie;
private JPanel optCarry;
/*______Composant pour la fenetre RejoindrePartie______*/
JButton retourChoix = new JButton("retour");
JButton retourMenu = new JButton("retour à la création de flotte");
JButton actualiser = new JButton("actualiser");
JButton joinPartie = new JButton("Rejoindre la partie");
private JButton retourChoix;
private JButton retourMenu;
private JButton actualiser;
private JButton joinPartie;
JLabel entreePseudoLabel = new JLabel("Entrez votre pseudo : ");
JTextField entreePseudo = new JTextField();
private JLabel entreePseudoLabel;
private JTextField entreePseudo;
JLabel explication = new JLabel("chercher une partie : ");
JLabel idChercherLabel = new JLabel("à partir d'une id : ");
JTextField idAChercher = new JTextField();
JButton idChercherBouton = new JButton("chercher");
private JLabel ChercherLabel;
private JTextField AChercher;
JLabel pseudoChercherLabel = new JLabel("à partir d'un pseudo : ");
JTextField pseudoAChercher = new JTextField();
JButton pseudoChercherBouton = new JButton("chercher");
JList parties = new JList();
private Game[] listeParties;
private JList<Game> parties;
/*_____Composant du Panel principal_____*/
JPanel rejoindre = new JPanel();
JPanel heberger = new JPanel();
private JPanel rejoindre;
private JPanel heberger;
boolean customize = false;
boolean creer = false;
boolean join = false;
boolean customize;
boolean creer;
boolean join;
public OptPartie(String titre) {
......@@ -56,31 +58,43 @@ public class OptPartie extends JPanel {
JPanel principal = new JPanel(new BorderLayout());
//GridLayout lay = new GridLayout(4,5);
rejoindre = new JPanel();
heberger = new JPanel();
customize = false;
creer = false;
join = false;
/*____________________panel rejoindre____________________*/
rejoindre.setLayout(new BorderLayout());
retourChoix = new JButton("retour");
retourMenu = new JButton("retour à la création de flotte");
actualiser = new JButton("actualiser");
joinPartie = new JButton("Rejoindre la partie");
entreePseudoLabel = new JLabel("Entrez votre pseudo : ");
entreePseudo = new JTextField();
ChercherLabel = new JLabel("chercher une partie :");
AChercher = new JTextField();
listeParties = new Game[0];
parties = new JList<Game>(listeParties);
JPanel ecriturePanelWest = new JPanel();
ecriturePanelWest.setLayout(new GridLayout(6, 3));
ecriturePanelWest.setLayout(new GridLayout(4, 2));
ecriturePanelWest.add(entreePseudoLabel);
ecriturePanelWest.add(entreePseudo);
ecriturePanelWest.add(new JPanel());
ecriturePanelWest.add(new JPanel()); ecriturePanelWest.add(new JPanel()); ecriturePanelWest.add(new JPanel());
ecriturePanelWest.add(explication);
ecriturePanelWest.add(new JPanel()); ecriturePanelWest.add(new JPanel());
ecriturePanelWest.add(idChercherLabel);
ecriturePanelWest.add(idAChercher);
ecriturePanelWest.add(idChercherBouton);
ecriturePanelWest.add(pseudoChercherLabel);
ecriturePanelWest.add(pseudoAChercher);
ecriturePanelWest.add(pseudoChercherBouton);
ecriturePanelWest.add(ChercherLabel); //TODO
ecriturePanelWest.add(AChercher);
ecriturePanelWest.add(new JPanel()); ecriturePanelWest.add(new JPanel());
......@@ -97,7 +111,16 @@ public class OptPartie extends JPanel {
boutonCarryRejoindre.add(actualiser);
rejoindre.add(boutonCarryRejoindre, BorderLayout.SOUTH);
rejoindre.add(parties, BorderLayout.EAST);
try {
listeParties = (Network.listInitializedGames(appli.getServerUrl())).toArray(new Game[0]);
parties = new JList<Game>(listeParties);
} catch (UnirestException e) {
e.printStackTrace();
}
rejoindre.add(new JScrollPane(parties), BorderLayout.EAST);
//player.getName et game.getID + type (belge, fr)
//bouton actualiser
//demander une flotte
......@@ -106,6 +129,13 @@ public class OptPartie extends JPanel {
/*____________________panel creer____________________*/
heberger.setLayout(new GridLayout());
vFr = new JRadioButton("version Française", true);
vBe = new JRadioButton("version Belge", false);
custom = new JCheckBox("partie customisée (non fonctionnel)", false);
tirRepete = new JCheckBox("tir répété", false);
grosTir = new JCheckBox("tir amélioré", false);
creerPartie = new JButton("Créer la partie");
optCarry = new JPanel();
optCarry.setLayout(new GridLayout(3,2));
optCarry.add(vFr);
......@@ -145,12 +175,8 @@ public class OptPartie extends JPanel {
return entreePseudo.getText();
}
public String getPseudoChercher(){
return pseudoAChercher.getText();
}
public String getIdChercher(){
return idAChercher.getText();
public String getChercher(){
return AChercher.getText();
}
public void actualiser(){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment