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