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