Commit 9d6acc1f authored by Hugo DACLON's avatar Hugo DACLON
Browse files

modif optPartie

parent 619359a3
......@@ -19,42 +19,39 @@ import com.mashape.unirest.http.exceptions.UnirestException;
import info1.application.appli;
import info1.network.Game;
import info1.network.Network;
import java.awt.event.*;
public class OptPartie extends JPanel {
/*______Composant pour la fenetre CreerPartie______*/
private JRadioButton vFr;
private JRadioButton vBe;
//------Composant généraux------
private JCheckBox custom;
private JCheckBox tirRepete;
private JCheckBox grosTir;
private JButton retourChoix;
private JButton retourMenu;
private JLabel entreePseudoLabel;
private JTextField choixPseudo;
private JButton creerPartie;
private JPanel optCarry;
/*______Composant pour la fenetre RejoindrePartie______*/
//------Composant pour la fenetre CreerPartie------
private JButton creerPartie;
//------Composant pour la fenetre RejoindrePartie------
private JButton retourChoix;
private JButton retourMenu;
private JButton actualiser;
private JButton joinPartie;
private JLabel entreePseudoLabel;
private JTextField entreePseudo;
private JLabel ChercherLabel;
private JTextField AChercher;
private JTextField recherche;
private Game[] listeParties;
private JList<Game> parties;
/*_____Composant du Panel principal_____*/
//------Composant du Panel principal------
private JPanel rejoindre;
private JPanel heberger;
private boolean customize;
private boolean creer;
private boolean join;
......@@ -70,11 +67,10 @@ public class OptPartie extends JPanel {
rejoindre = new JPanel();
heberger = new JPanel();
customize = false;
creer = false;
join = false;
/*____________________panel rejoindre____________________*/
/*------------------------panel rejoindre------------------------*/
rejoindre.setLayout(new BorderLayout());
......@@ -84,10 +80,10 @@ public class OptPartie extends JPanel {
joinPartie = new JButton("Rejoindre la partie");
entreePseudoLabel = new JLabel("Entrez votre pseudo : ");
entreePseudo = new JTextField();
choixPseudo = new JTextField();
ChercherLabel = new JLabel("chercher une partie :");
AChercher = new JTextField();
recherche = new JTextField();
listeParties = new Game[0];
......@@ -96,13 +92,13 @@ public class OptPartie extends JPanel {
JPanel ecriturePanelWest = new JPanel();
ecriturePanelWest.setLayout(new GridLayout(4, 2));
ecriturePanelWest.add(entreePseudoLabel);
ecriturePanelWest.add(entreePseudo);
ecriturePanelWest.add(new JPanel()); ecriturePanelWest.add(new JPanel());
ecriturePanelWest.add(choixPseudo);
ecriturePanelWest.add(new JPanel());
ecriturePanelWest.add(new JPanel());
ecriturePanelWest.add(ChercherLabel); //TODO
ecriturePanelWest.add(AChercher);
ecriturePanelWest.add(recherche);
ecriturePanelWest.add(new JPanel()); ecriturePanelWest.add(new JPanel());
......@@ -135,28 +131,20 @@ public class OptPartie extends JPanel {
//demander une flotte
rejoindre.setVisible(false);
principal.add(rejoindre,BorderLayout.WEST);
/*____________________panel creer____________________*/
/*------------------------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);
optCarry.add(vBe);
optCarry.add(custom);
optCarry.add(creerPartie);
heberger.add(optCarry);
heberger.setVisible(false);
principal.add(heberger,BorderLayout.EAST);
/*____________________fin des layouts____________________*/
/*------------------------fin des layouts------------------------*/
principal.setVisible(true);
this.add(principal);
......@@ -180,31 +168,22 @@ public class OptPartie extends JPanel {
this.setName(nouveau);
}
public String getPseudoChoisi(){
return entreePseudo.getText();
public String getPseudo(){
return choixPseudo.getText();
}
public String getChercher(){
return AChercher.getText();
return recherche.getText();
}
public void actualiser(){
if(join == true)
if(join || creer)
{
this.rejoindre.setVisible(true);
this.heberger.setVisible(false);
this.rejoindre.setVisible(join);
this.heberger.setVisible(!join);
//foreach partie dans la liste partie : créer un nouveau ensemble de composants
// contenant : player.getName et game.getID + type (belge, fr) et bouton rejoindre
}
else {
if(creer == true){
this.heberger.setVisible(true);
this.rejoindre.setVisible(false);
if(customize == true) { //l'action listener de customize va actualiser
optCarry.add(tirRepete);
optCarry.add(grosTir);
}
}
}
}
}
......@@ -4,6 +4,7 @@ import java.awt.Color;
import java.awt.Component;
import javax.swing.JPanel;
import javax.swing.JTextField;
import com.mashape.unirest.http.exceptions.UnirestException;
......@@ -201,8 +202,8 @@ public class appli {
if (component instanceof JPanel){
setBgColorComponents((JPanel) component, c);
}
component.setForeground(Color.WHITE);
component.setBackground(c);
component.setForeground(component instanceof JTextField ? c : Color.WHITE);
component.setBackground(component instanceof JTextField ? Color.WHITE : c);
}
jPanel.setOpaque(false);
jPanel.setBackground(c);
......
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