Commit 34f868ef authored by Benjamin VU's avatar Benjamin VU
Browse files

Fenetre Connexion

parent c34e4b90
......@@ -19,12 +19,13 @@ import java.util.ArrayList;
*/
public class Application {
public static void main(String[] args) throws InterruptedException, BadCoordException, CoordsBadShipException, UncompleteFleetException, UnirestException, BadIdException {
FenetreConnexion test = new FenetreConnexion("Connexion au serveur et aux parties");
FenetreConnexion fc = new FenetreConnexion("Connexion au serveur et aux parties");
// http://172.26.82.18//api/v0 (URL à changer si ca ne marche pas)
test.setPreferredSize(new Dimension(800,400));
test.pack();
test.setVisible(true);
fc.setPreferredSize(new Dimension(700, 700));
//fc.setResizable(false);
fc.pack();
fc.setVisible(true);
//TODO IHM changer le nom de jaquie
Player jaquie = new Player("Jaquie");
......
......@@ -5,80 +5,76 @@ import info1.network.Player;
import javax.swing.*;
import java.awt.*;
/**
* La classe vue.FenetreConnexion permettant de se connecter au serveur et avoir accès aux différentes parties
*
* @author Maeva Billaut
* @version 1.0
*/
import javax.swing.*;
import java.awt.*;
public class FenetreConnexion extends JFrame {
private JList<Integer> listePartie;
private JList<String> listeStringPartie;
private JTextField pseudo;
private JButton envoyepseudo;
private JComboBox pInitialise;
private JTextField textLogin;
private JButton rejoindre;
private JButton creerPartie;
private JTextArea zoneMessage;
public FenetreConnexion(String titre){
super();
private Integer gameId;
JPanel principal = new JPanel(new BorderLayout());
this.setContentPane(principal);
private JButton boutonConnexion;
private JButton boutonActualiser;
private JButton boutonRejoindre;
private JButton boutonCreer;
JPanel north = new JPanel(new FlowLayout());
pseudo = new JTextField("Pseudo");
pseudo.setPreferredSize(new Dimension(100,30));
envoyepseudo = new JButton();
envoyepseudo.setPreferredSize(new Dimension(30,30));
north.add(pseudo);
north.add(envoyepseudo);
principal.add(north,BorderLayout.NORTH);
JPanel grille = new JPanel();
grille.setLayout(new GridLayout(10,10));
for (int i =0; i<(10*10); i++){
final JLabel label = new JLabel(" ");
label.setBorder(BorderFactory.createLineBorder(Color.BLACK));
grille.add(label);
}
principal.add(grille,BorderLayout.CENTER);
JPanel bas = new JPanel(new BorderLayout());
pInitialise = new JComboBox();
bas.add(pInitialise,BorderLayout.NORTH);
JPanel boutons = new JPanel(new FlowLayout());
rejoindre = new JButton("Rejoindre");
creerPartie = new JButton("Créer partie");
boutons.add(rejoindre);
boutons.add(creerPartie);
bas.add(boutons,BorderLayout.CENTER);
zoneMessage = new JTextArea("ZONE MESSAGE");
zoneMessage.setPreferredSize(new Dimension(100,100));
bas.add(zoneMessage,BorderLayout.SOUTH);
principal.add(bas,BorderLayout.SOUTH);
JPanel vide = new JPanel(new FlowLayout());
principal.add(vide,BorderLayout.WEST);
JPanel vide2 = new JPanel(new FlowLayout());
principal.add(vide,BorderLayout.EAST);
private boolean creerPartie = false;
public FenetreConnexion(String titre) {
super(titre);
// JPanel principal
JPanel principal = new JPanel();
this.setContentPane(principal);
// JPanel connexion
JPanel connexion = new JPanel();
connexion.setLayout(new GridLayout(1,2));
// JPanel login
JPanel login = new JPanel();
JLabel textelogin = new JLabel("Login : ");
login.add(textelogin);
textLogin = new JTextField();
Dimension taille = new Dimension(300, 20);
textLogin.setPreferredSize(taille);
login.add(textLogin);
login.setLayout(new FlowLayout(FlowLayout.LEFT));
connexion.add(login);
boutonConnexion = new JButton("Connexion");
connexion.add(boutonConnexion);
principal.add(connexion, BorderLayout.EAST);
// Vue pour choisir une partie
listePartie = new JList<>(new DefaultListModel<>());
listeStringPartie = new JList<>(new DefaultListModel<>());
JScrollPane panelListe = new JScrollPane(listeStringPartie);
panelListe.setPreferredSize(new Dimension(200,300));
principal.add(panelListe, BorderLayout.CENTER);
JPanel panelBouton = new JPanel();
panelBouton.setLayout(new GridLayout(1,3,60,0));
boutonCreer = new JButton("creer Partie");
panelBouton.add(boutonCreer);
boutonRejoindre = new JButton("Rejoindre");
panelBouton.add(boutonRejoindre);
boutonActualiser = new JButton("Actualiser");
panelBouton.add(boutonActualiser);
principal.add(panelBouton, BorderLayout.SOUTH);
//boutonActualiser.addActionListener(new ActualisationServeur(this));
//listestringpartie.addListSelectionListener(new SelectionListeServeurControleur(this));
//boutonRejoindre.addActionListener(new RejoindreControleur(this)); //get player
//boutonCreer.addActionListener(new CreerPartieControleur(this)); //get player
//boutonconnexion.addActionListener(new ConnexionPlayerControleur(this));
boutonActualiser.setEnabled(false);
boutonCreer.setEnabled(false);
boutonRejoindre.setEnabled(false);
}
}
/*
// Les getters
public boolean getStatutActualiser(){ return boutonActualiser.isEnabled(); }
......@@ -99,4 +95,6 @@ public class FenetreConnexion extends JFrame {
public void visibleRejoidre(){ boutonRejoindre.setEnabled(true); }
public void visibleActualiser(){ boutonActualiser.setEnabled(true); }
}
}*/
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