Nantes Université
Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
T
Trivial Pursuit Houssem
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneurs
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Service d'assistance
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Houssem eddine RAJBENI
Trivial Pursuit Houssem
Validations
bc128140
Valider
bc128140
rédigé
1 year ago
par
Houssem eddine RAJBENI
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
refactor : introduced lambdas
no need to remove comment they are important to understand code. close
#28
,
#2
parent
b5d058e4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
module-b/src/main/java/fr/unantes/sce/trivial/view/Window.java
+75
-97
75 ajouts, 97 suppressions
...e-b/src/main/java/fr/unantes/sce/trivial/view/Window.java
avec
75 ajouts
et
97 suppressions
module-b/src/main/java/fr/unantes/sce/trivial/view/Window.java
+
75
−
97
Voir le fichier @
bc128140
...
@@ -23,7 +23,8 @@ import fr.unantes.sce.trivial.utility.Audio;
...
@@ -23,7 +23,8 @@ import fr.unantes.sce.trivial.utility.Audio;
*/
*/
public
class
Window
extends
JFrame
public
class
Window
extends
JFrame
{
{
public
static
final
String
INFORMATION
=
"Information"
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
private
Audio
son
;
private
Audio
son
;
boolean
activer
=
true
;
// Son activer/d�sactiver
boolean
activer
=
true
;
// Son activer/d�sactiver
...
@@ -214,34 +215,29 @@ public class Window extends JFrame
...
@@ -214,34 +215,29 @@ public class Window extends JFrame
{
{
jmiLogout
=
new
JMenuItem
(
"Logout"
);
jmiLogout
=
new
JMenuItem
(
"Logout"
);
jmiLogout
.
setEnabled
(
false
);
jmiLogout
.
setEnabled
(
false
);
jmiLogout
.
addActionListener
(
new
ActionListener
(){
jmiLogout
.
addActionListener
(
e
->
{
//on passe � false toutes les valeurs
setIsAdmin
(
false
);
setIsConnected
(
false
);
setPlayer
(
null
);
@Override
//on desactive le bouton Logout
public
void
actionPerformed
(
ActionEvent
e
)
Window
.
this
.
getJmiLogout
().
setEnabled
(
false
);
{
//on passe � false toutes les valeurs
//Comme on se deconnecte on revient sur la page du d�but
setIsAdmin
(
false
);
getPanelCartes
().
getCl
().
show
(
getPanelCartes
(),
"Start"
);
setIsConnected
(
false
);
setPlayer
(
null
);
// On desactive les boutons Admin
desactiveButtonsQuestions
();
//on desactive le bouton Logout
Window
.
this
.
getJmiLogout
().
setEnabled
(
false
);
//on active le bouton login
Window
.
this
.
getJmiLogin
().
setEnabled
(
true
);
//Comme on se deconnecte on revient sur la page du d�but
getPanelCartes
().
getCl
().
show
(
getPanelCartes
(),
"Start"
);
JOptionPane
.
showMessageDialog
(
null
,
"Logout succesfull !"
,
INFORMATION
,
JOptionPane
.
INFORMATION_MESSAGE
);
// On desactive les boutons Admin
desactiveButtonsQuestions
();
});
//on active le bouton login
Window
.
this
.
getJmiLogin
().
setEnabled
(
true
);
JOptionPane
.
showMessageDialog
(
null
,
"Logout succesfull !"
,
"Information"
,
JOptionPane
.
INFORMATION_MESSAGE
);
}
});
}
}
return
jmiLogout
;
return
jmiLogout
;
}
}
...
@@ -274,58 +270,51 @@ public class Window extends JFrame
...
@@ -274,58 +270,51 @@ public class Window extends JFrame
if
(
jmiLogin
==
null
)
if
(
jmiLogin
==
null
)
{
{
jmiLogin
=
new
JMenuItem
(
"Login"
);
jmiLogin
=
new
JMenuItem
(
"Login"
);
jmiLogin
.
addActionListener
(
new
ActionListener
(){
jmiLogin
.
addActionListener
(
e
->
{
PanelLogin
panelLogin
=
new
PanelLogin
();
@Override
public
void
actionPerformed
(
ActionEvent
e
)
int
choixLog
=
panelLogin
.
isVerifyLoginAdmin
();
{
PanelLogin
panelLogin
=
new
PanelLogin
();
if
(
choixLog
==
0
)
// annulation
return
;
int
choixLog
=
panelLogin
.
isVerifyLoginAdmin
();
else
if
(
choixLog
==
1
)
// connect�
{
if
(
choixLog
==
0
)
// annulation
isConnected
=
true
;
{
//on r�cupere le joueur connect�
}
Window
.
this
.
setPlayer
(
panelLogin
.
getPlayer
());
else
if
(
choixLog
==
1
)
// connect�
{
//on active le logout
isConnected
=
true
;
Window
.
this
.
getJmiLogout
().
setEnabled
(
true
);
//on r�cupere le joueur connect�
// on desactive les boutons Admin
Window
.
this
.
setPlayer
(
panelLogin
.
getPlayer
());
desactiveButtonsQuestions
();
//on active le logout
JOptionPane
.
showMessageDialog
(
null
,
"Logout succesfull as player !"
,
INFORMATION
,
JOptionPane
.
INFORMATION_MESSAGE
);
Window
.
this
.
getJmiLogout
().
setEnabled
(
true
);
}
// on desactive les boutons Admin
desactiveButtonsQuestions
();
else
// connect� en admin
{
JOptionPane
.
showMessageDialog
(
null
,
"Logout succesfull as player !"
,
"Information"
,
JOptionPane
.
INFORMATION_MESSAGE
);
//TODO on ne recupere pas l'admin pour le jeu ici
}
// on active le bouton ajouter question et le logout
else
// connect� en admin
isAdmin
=
true
;
{
isConnected
=
true
;
Window
.
this
.
getJmiAddQuestion
().
setEnabled
(
true
);
//TODO on ne recupere pas l'admin pour le jeu ici
Window
.
this
.
getJmiLogout
().
setEnabled
(
true
);
// on active le bouton ajouter question et le logout
// on active les boutons ajouter et supprimer du panelQuestion
isAdmin
=
true
;
PanelButtons
panelButtonsQuestion
=
Window
.
this
.
getPanelCartes
().
getPanelQuestion
().
getPanelButtons
();
isConnected
=
true
;
panelButtonsQuestion
.
getJbAjouter
().
setVisible
(
true
);
Window
.
this
.
getJmiAddQuestion
().
setEnabled
(
true
);
panelButtonsQuestion
.
getjbSupprimer
().
setVisible
(
true
);
Window
.
this
.
getJmiLogout
().
setEnabled
(
true
);
JOptionPane
.
showMessageDialog
(
null
,
"Login succesfull as Admin!"
,
INFORMATION
,
JOptionPane
.
INFORMATION_MESSAGE
);
// on active les boutons ajouter et supprimer du panelQuestion
}
PanelButtons
panelButtonsQuestion
=
Window
.
this
.
getPanelCartes
().
getPanelQuestion
().
getPanelButtons
();
});
panelButtonsQuestion
.
getJbAjouter
().
setVisible
(
true
);
panelButtonsQuestion
.
getjbSupprimer
().
setVisible
(
true
);
JOptionPane
.
showMessageDialog
(
null
,
"Login succesfull as Admin!"
,
"Information"
,
JOptionPane
.
INFORMATION_MESSAGE
);
}
}
});
}
}
return
jmiLogin
;
return
jmiLogin
;
}
}
...
@@ -345,7 +334,7 @@ public class Window extends JFrame
...
@@ -345,7 +334,7 @@ public class Window extends JFrame
@SuppressWarnings
(
"deprecation"
)
@SuppressWarnings
(
"deprecation"
)
@Override
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
public
void
actionPerformed
(
ActionEvent
e
)
{
if
(
isActiver
()
==
true
){
if
(
isActiver
()){
setActiver
(
false
);
setActiver
(
false
);
getSon
().
interrupt
();
// on stoppe tout son
getSon
().
interrupt
();
// on stoppe tout son
}
}
...
@@ -373,15 +362,7 @@ public class Window extends JFrame
...
@@ -373,15 +362,7 @@ public class Window extends JFrame
{
{
jmiAddQuestion
=
new
JMenuItem
(
"Add Question"
);
jmiAddQuestion
=
new
JMenuItem
(
"Add Question"
);
jmiAddQuestion
.
setEnabled
(
false
);
jmiAddQuestion
.
setEnabled
(
false
);
jmiAddQuestion
.
addActionListener
(
new
ActionListener
(){
jmiAddQuestion
.
addActionListener
(
arg0
->
Window
.
this
.
getPanelCartes
().
getCl
().
show
(
Window
.
this
.
getPanelCartes
(),
"AddQuestion"
));
public
void
actionPerformed
(
ActionEvent
arg0
)
{
Window
.
this
.
getPanelCartes
().
getCl
().
show
(
Window
.
this
.
getPanelCartes
(),
"AddQuestion"
);
}
});
}
}
return
jmiAddQuestion
;
return
jmiAddQuestion
;
}
}
...
@@ -418,14 +399,11 @@ public class Window extends JFrame
...
@@ -418,14 +399,11 @@ public class Window extends JFrame
if
(
jmiFermer
==
null
)
if
(
jmiFermer
==
null
)
{
{
jmiFermer
=
new
JMenuItem
(
"Close"
);
jmiFermer
=
new
JMenuItem
(
"Close"
);
jmiFermer
.
addActionListener
(
new
ActionListener
(){
jmiFermer
.
addActionListener
(
arg0
->
{
public
void
actionPerformed
(
ActionEvent
arg0
)
int
reponse
=
JOptionPane
.
showConfirmDialog
(
Window
.
this
,
"Voulez-vous quitter l'application"
,
"Confirmation"
,
JOptionPane
.
YES_NO_OPTION
,
JOptionPane
.
QUESTION_MESSAGE
);
{
if
(
reponse
==
JOptionPane
.
YES_OPTION
)
int
reponse
=
JOptionPane
.
showConfirmDialog
(
Window
.
this
,
"Voulez-vous quitter l'application"
,
"Confirmation"
,
JOptionPane
.
YES_NO_OPTION
,
JOptionPane
.
QUESTION_MESSAGE
);
System
.
exit
(
0
);
if
(
reponse
==
JOptionPane
.
YES_OPTION
)
});
System
.
exit
(
0
);
}
});
}
}
return
jmiFermer
;
return
jmiFermer
;
}
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter