Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tristan MAISONNEUVE
projetS2-2021-23-LJ
Commits
5dea7ab4
Commit
5dea7ab4
authored
Jun 23, 2021
by
Tristan MAISONNEUVE
Browse files
Fenetre Jeux,Init
parent
92ece3c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Application.java
View file @
5dea7ab4
...
@@ -120,7 +120,7 @@ public class Application {
...
@@ -120,7 +120,7 @@ public class Application {
System
.
out
.
println
(
"-9999 sinon aka rien / probleme"
);
System
.
out
.
println
(
"-9999 sinon aka rien / probleme"
);
break
;
break
;
default
:
default
:
System
.
out
.
println
(
"gros probleme !!!"
);
//
System.out.println("gros probleme !!!");
break
;
break
;
}
}
Thread
.
sleep
(
500
);
Thread
.
sleep
(
500
);
...
@@ -138,4 +138,4 @@ public class Application {
...
@@ -138,4 +138,4 @@ public class Application {
}
}
}
}
\ No newline at end of file
src/vue/FenetreConnexion.java
View file @
5dea7ab4
...
@@ -122,9 +122,10 @@ public class FenetreConnexion extends JFrame {
...
@@ -122,9 +122,10 @@ 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
(
Color
.
GRAY
);
bouttons
[
i
].
getButton
().
setBackground
(
random
Color
);
bouttons
[
i
].
getButton
().
setEnabled
(
false
);
bouttons
[
i
].
getButton
().
setEnabled
(
false
);
}
}
}
}
...
...
src/vue/FenetreJeux.java
View file @
5dea7ab4
package
vue
;
package
vue
;
import
com.sun.source.tree.NewArrayTree
;
import
info1.network.Game
;
import
info1.network.Network
;
import
info1.ships.BadCoordException
;
import
info1.ships.BadCoordException
;
import
info1.ships.CoordsBadShipException
;
import
info1.ships.CoordsBadShipException
;
import
info1.ships.ICoord
;
import
info1.ships.ICoord
;
...
@@ -14,8 +17,6 @@ import java.awt.event.ActionListener;
...
@@ -14,8 +17,6 @@ import java.awt.event.ActionListener;
import
java.util.List
;
import
java.util.List
;
public
class
FenetreJeux
extends
JFrame
{
public
class
FenetreJeux
extends
JFrame
{
private
JTextField
pseudo
;
private
JButton
envoyepseudo
;
private
JComboBox
pInitialise
;
private
JComboBox
pInitialise
;
private
JButton
rejoindre
;
private
JButton
rejoindre
;
...
@@ -28,14 +29,6 @@ public class FenetreJeux extends JFrame {
...
@@ -28,14 +29,6 @@ public class FenetreJeux extends JFrame {
this
.
setContentPane
(
principal
);
this
.
setContentPane
(
principal
);
JPanel
north
=
new
JPanel
(
new
FlowLayout
());
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
);
principal
.
add
(
north
,
BorderLayout
.
NORTH
);
JPanel
grille
=
new
JPanel
();
JPanel
grille
=
new
JPanel
();
...
@@ -77,7 +70,8 @@ public class FenetreJeux extends JFrame {
...
@@ -77,7 +70,8 @@ public class FenetreJeux extends JFrame {
boutton
.
getButton
().
addActionListener
(
new
ActionListener
()
{
boutton
.
getButton
().
addActionListener
(
new
ActionListener
()
{
@Override
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
public
void
actionPerformed
(
ActionEvent
e
)
{
boutton
.
getButton
().
setBackground
(
Color
.
RED
);
boutton
.
getButton
().
setEnabled
(
false
);
}});
}});
grille
.
add
(
boutton
.
getButton
());
grille
.
add
(
boutton
.
getButton
());
}
}
...
@@ -87,13 +81,7 @@ public class FenetreJeux extends JFrame {
...
@@ -87,13 +81,7 @@ public class FenetreJeux extends JFrame {
JPanel
bas
=
new
JPanel
(
new
BorderLayout
());
JPanel
bas
=
new
JPanel
(
new
BorderLayout
());
pInitialise
=
new
JComboBox
();
bas
.
add
(
pInitialise
,
BorderLayout
.
NORTH
);
JPanel
boutons
=
new
JPanel
(
new
FlowLayout
());
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
);
bas
.
add
(
boutons
,
BorderLayout
.
CENTER
);
...
@@ -109,4 +97,5 @@ public class FenetreJeux extends JFrame {
...
@@ -109,4 +97,5 @@ public class FenetreJeux extends JFrame {
JPanel
vide2
=
new
JPanel
(
new
FlowLayout
());
JPanel
vide2
=
new
JPanel
(
new
FlowLayout
());
principal
.
add
(
vide
,
BorderLayout
.
EAST
);
principal
.
add
(
vide
,
BorderLayout
.
EAST
);
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment