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
0e978326
Commit
0e978326
authored
Jun 24, 2021
by
Tristan MAISONNEUVE
Browse files
Setter + getter valtocuhe feetre jeux
parent
4b525874
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/vue/FenetreJeux.java
View file @
0e978326
...
@@ -21,6 +21,8 @@ public class FenetreJeux extends JFrame {
...
@@ -21,6 +21,8 @@ public class FenetreJeux extends JFrame {
private
static
Coord
coco
=
null
;
private
static
Coord
coco
=
null
;
//création de la classe Fenetre jeux extension de JFrame
//création de la classe Fenetre jeux extension de JFrame
private
static
int
valtouche
=
-
1
;
//initialisation de tout les widget
//initialisation de tout les widget
private
JTextArea
zoneMessage
;
private
JTextArea
zoneMessage
;
private
JLabel
bleu
;
private
JLabel
bleu
;
...
@@ -90,11 +92,15 @@ public class FenetreJeux extends JFrame {
...
@@ -90,11 +92,15 @@ public class FenetreJeux extends JFrame {
@Override
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
public
void
actionPerformed
(
ActionEvent
e
)
{
try
{
coco
=
new
Coord
(
boutton
.
getString
());}
catch
(
BadCoordException
badCoordException
){
badCoordException
.
printStackTrace
();}
try
{
coco
=
new
Coord
(
boutton
.
getString
());}
catch
(
BadCoordException
badCoordException
){
badCoordException
.
printStackTrace
();}
while
(
valtouche
==-
1
){}
if
(
valtouche
==
0
){
boutton
.
getButton
().
setBackground
(
Color
.
BLUE
);}
//Créer l'actionPerfomed lorsqu'on clique sur un bouton
//Créer l'actionPerfomed lorsqu'on clique sur un bouton
boutton
.
getButton
().
setBackground
(
Color
.
RED
);
boutton
.
getButton
().
setBackground
(
Color
.
RED
);
//On met le bouton en rouge
//On met le bouton en rouge
boutton
.
getButton
().
setEnabled
(
false
);
boutton
.
getButton
().
setEnabled
(
false
);
//et on le desactive
//et on le desactive
coco
=
null
;
valtouche
=-
1
;
}});
}});
grille
.
add
(
boutton
.
getButton
());
grille
.
add
(
boutton
.
getButton
());
}
}
...
@@ -129,5 +135,12 @@ public class FenetreJeux extends JFrame {
...
@@ -129,5 +135,12 @@ public class FenetreJeux extends JFrame {
}
}
public
static
Coord
getCoco
()
{
return
coco
;}
public
static
Coord
getCoco
()
{
return
coco
;}
public
static
void
setValtouche
(
int
valtouche
)
{
this
.
valtouche
=
valtouche
;
}
//-10 pas ton tour, 0 rien touché, 1 touché, 10 touché coulé,100 gagné.
}
}
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