Commit d4351ed2 authored by Benjamin VU's avatar Benjamin VU
Browse files

Text en haut

parent d343844b
......@@ -5,10 +5,7 @@ import com.mashape.unirest.http.exceptions.UnirestException;
import info1.network.Game;
import info1.network.Network;
import info1.network.Player;
import info1.ships.BadCoordException;
import info1.ships.CoordsBadShipException;
import info1.ships.ICoord;
import info1.ships.ShipCategory;
import info1.ships.*;
import modele.info1.ships.Bouttons;
import modele.info1.ships.Coord;
import modele.info1.ships.CreationB;
......@@ -28,6 +25,7 @@ public class FenetreConnexion extends JFrame {
private JTextField pseudo;
private JButton envoyepseudo;
private JComboBox pInitialise;
private JLabel Infocliquable;
private JButton rejoindre;
private JButton creerPartie;
......@@ -48,14 +46,20 @@ public class FenetreConnexion extends JFrame {
JPanel principal = new JPanel(new BorderLayout());
this.setContentPane(principal);
JPanel north = new JPanel(new FlowLayout());
JPanel north = new JPanel(new BorderLayout());
JPanel pseudoP = new JPanel(new FlowLayout());
JLabel labelpseudo = new JLabel("Pseudo : ");
north.add(labelpseudo);
pseudoP.add(labelpseudo);
pseudo = new JTextField();
pseudo.setPreferredSize(new Dimension(100,30));
north.add(pseudo);
//north.add(envoyepseudo);
Infocliquable = new JLabel(" Cliquer sur un des deux pays pour commencer a positioner votre flotte");
Infocliquable.setPreferredSize(new Dimension(100,30));
pseudoP.add(pseudo);
north.add(pseudoP,BorderLayout.NORTH);
north.add(Infocliquable,BorderLayout.CENTER);
principal.add(north,BorderLayout.NORTH);
JPanel grille = new JPanel();
......@@ -99,6 +103,8 @@ public class FenetreConnexion extends JFrame {
boutton.getButton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final Color randomColor = new Color((int)(Math.random() * (255-50)),(int)(Math.random() * (255-50)),(int)(Math.random() * (255-50)));
if(co[0]==null){
co[0]=boutton.getString();
boutton.getButton().setBackground(Color.LIGHT_GRAY);
......@@ -111,6 +117,7 @@ public class FenetreConnexion extends JFrame {
ShipCategory s = c.TestCreation().gettheCategory();
if(s==ShipCategory.SUBMARINE){
pays[0]--;
} if (s==ShipCategory.DESTROYER) {
pays[1]--;
} if (s==ShipCategory.CRUISER) {
......@@ -123,7 +130,6 @@ public class FenetreConnexion extends JFrame {
System.out.println(Arrays.toString(pays));
System.out.println(flotte.getShips());
List<ICoord> listec = c.TestCreation().getCoords();
final Color randomColor = new Color((int)(Math.random() * (255-50)),(int)(Math.random() * (255-50)),(int)(Math.random() * (255-50)));
for(int i=0;i<100;i++){
if(listec.contains(new Coord(bouttons[i].getString()))){
bouttons[i].getButton().setBackground(randomColor);
......@@ -167,26 +173,25 @@ public class FenetreConnexion extends JFrame {
principal.add(grille,BorderLayout.CENTER);
JPanel bas = new JPanel(new BorderLayout());
JPanel bas2 = new JPanel(new FlowLayout(FlowLayout.CENTER));
JLabel Infocliquable;
Infocliquable = new JLabel("Cliquer sur un des deux pays pour commencer a positioner votre flotte");
Infocliquable.setPreferredSize(new Dimension(100,30));
bas2.add(Infocliquable,BorderLayout.SOUTH);
envoyepseudo = new JButton("Valider pseudo et flotte");
envoyepseudo.setPreferredSize(new Dimension(100,30));
bas.add(envoyepseudo,BorderLayout.CENTER);
zoneMessage = new JTextArea("ZONE MESSAGE \n pseudo et flotte");
zoneMessage.setPreferredSize(new Dimension(100,50));
zoneMessage.setEditable(false);
bas.add(zoneMessage,BorderLayout.NORTH);
principal.add(bas2, BorderLayout.SOUTH);
//bas.add(Infocliquable,BorderLayout.SOUTH);
principal.add(bas, BorderLayout.SOUTH);
JPanel est = new JPanel(new GridLayout(10,1));
pInitialise = new JComboBox();
......@@ -246,12 +251,12 @@ public class FenetreConnexion extends JFrame {
public void actionPerformed(ActionEvent e) {
france.setEnabled(false);
belgique.setEnabled(true);
textePays.setText("Bateau de la france:\n1 porte-avions, 1 cuirassé\n2 croiseurs, 2 Torpilleur, 1 Sous-marins");
textePays.setText("Bateaux de la France:\n1 porte-avions, 1 cuirassé\n2 croiseurs, 2 Torpilleur, 1 Sous-marins");
pays[0] = 1; pays[1] = 2; pays[2] = 2; pays[3] = 1; pays[4] = 1;
for(int i=0;i<100;i++){
bouttons[i].getButton().setBackground(Color.WHITE);
bouttons[i].getButton().setEnabled(true);
}
bouttons[i].getButton().setEnabled(true); }
flotte = new NavyFleet();
System.out.println(Arrays.toString(pays));
}
......@@ -262,7 +267,7 @@ public class FenetreConnexion extends JFrame {
public void actionPerformed(ActionEvent e) {
france.setEnabled(true);
belgique.setEnabled(false);
textePays.setText("Bateau de la france\n1 cuirassé, 2 croiseurs\n3 Torpilleur, 4 Sous-marins");
textePays.setText("Bateaux de la Belgique\n1 cuirassé, 2 croiseurs\n3 Torpilleur, 4 Sous-marins");
pays[0] = 4; pays[1] = 3; pays[2] = 2; pays[3] = 1; pays[4] = 0;
for(int i=0;i<100;i++){
bouttons[i].getButton().setBackground(Color.WHITE);
......
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