Commit e60582e2 authored by Jérémie's avatar Jérémie
Browse files

ferme la fenetre y'a courant d'air

parent 29de5c3e
import PremiereFenetre.PremiereFenetre;
import com.mashape.unirest.http.exceptions.UnirestException;
import info1.network.*;
import info1.ships.BadCoordException;
......@@ -20,14 +21,16 @@ public class Application {
public static void main(String[] args) throws InterruptedException {
/*
FenetreConnexion fc = new FenetreConnexion("Connexion au serveur et aux parties");
fc.setPreferredSize(new Dimension(700, 700));
//fc.setResizable(false);
fc.pack();
fc.setVisible(true);
*/
PremiereFenetre pf = new PremiereFenetre();
Network.setProxy("srv-proxy-etu-2.iut-nantes.univ-nantes.prive",3128);
Network.enableProxy(true);
......@@ -70,7 +73,7 @@ public class Application {
-100 si la partie est perdue par le joueur courant ;
-9999 sinon
*/
/*
boolean partie_bool = true;
int info;
while(partie_bool){
......@@ -109,7 +112,7 @@ public class Application {
}
Thread.sleep(500);
}
*/
......
package PremiereFenetre;
import vue.FenetreConnexion;
import java.awt.*;
public class PremiereFenetre {
static FenetreConnexion fc = new FenetreConnexion("Connexion au serveur et aux parties");
public PremiereFenetre(){
fc.setPreferredSize(new Dimension(700, 700));
//fc.setResizable(false);
fc.pack();
fc.setVisible(true);
}
public static void close(){
fc.dispose();
}
}
package vue;
import PremiereFenetre.PremiereFenetre;
import info1.network.Player;
import javax.swing.*;
......@@ -82,7 +83,8 @@ public class FenetreConnexion extends JFrame {
rejoindre.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FenetreJeux fJeux = new FenetreJeux();
PremiereFenetre.close();
FenetreJeux fJeux = new FenetreJeux("yolo");
fJeux.setPreferredSize(new Dimension(700, 700));
fJeux.pack();
fJeux.setVisible(true);
......
......@@ -2,12 +2,88 @@ package vue;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class FenetreJeux extends JFrame {
public FenetreJeux() {
super();
private JTextField pseudo;
private JButton envoyepseudo;
private JComboBox pInitialise;
private JButton rejoindre;
private JButton creerPartie;
private JTextArea zoneMessage;
public FenetreJeux(String titre){
super(titre);
JPanel principal = new JPanel(new BorderLayout());
this.setContentPane(principal);
JPanel north = new JPanel(new FlowLayout());
JLabel labelpseudo = new JLabel("Pseudo : ");
north.add(labelpseudo);
pseudo = new JTextField();
pseudo.setPreferredSize(new Dimension(100,30));
envoyepseudo = new JButton("Connexion");
envoyepseudo.setPreferredSize(new Dimension(100,30));
north.add(pseudo);
north.add(envoyepseudo);
principal.add(north,BorderLayout.NORTH);
JPanel grille = new JPanel();
grille.setLayout(new GridLayout(11,11));
for (int i=0; i<11;i++){
String[] lettres={" ","A","B","C","D","E","F","G","H","I","J"};
final JLabel labellettre = new JLabel(lettres[i],SwingConstants.CENTER);
labellettre.setBorder(BorderFactory.createLineBorder(Color.BLACK));
grille.add(labellettre);
}
int j=0;
for (int i =0; i<(11*10); i++){
String[] nombres={"1","2","3","4","5","6","7","8","9","10"};
final JButton label = new JButton(" ");
if(i%11==0) {
final JLabel labelchiffres = new JLabel(nombres[j],SwingConstants.CENTER);
labelchiffres.setBorder(BorderFactory.createLineBorder(Color.BLACK));
grille.add(labelchiffres);
j++;
}
else{
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);
}
}
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