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
Loïc Perine
ProjetS2-2021-20-JMM
Commits
7d4b0289
Commit
7d4b0289
authored
Jun 24, 2021
by
Noah SIGOIGNE
Browse files
modification de OptPartie : ajout des panel chercherpartie et creerpartie
parent
643fbe4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/info1/Vue/OptPartie.java
View file @
7d4b0289
...
...
@@ -16,17 +16,32 @@ public class OptPartie extends JPanel {
JCheckBox
grosTir
=
new
JCheckBox
(
"tir amélioré"
,
false
);
JButton
creerPartie
=
new
JButton
(
"Créer la partie"
);
JPanel
optCarry
=
new
JPanel
();
/*______Composant pour la fenetre RejoindrePartie______*/
JButton
joinPartie
=
new
JButton
(
"Rejoindre la partie"
);
JButton
actualiser
=
new
JButton
(
"actualiser"
);
JTextField
entreePseudo
=
new
JTextField
();
JButton
retourChoix
=
new
JButton
(
"retour"
);
JButton
retourMenu
=
new
JButton
(
"retour à la création de flotte"
);
JButton
actualiser
=
new
JButton
(
"actualiser"
);
JButton
joinPartie
=
new
JButton
(
"Rejoindre la partie"
);
//JPanel boutonCarryChoix = new JPanel();
JLabel
entreePseudoLabel
=
new
JLabel
(
"Entrez votre pseudo : "
);
JTextField
entreePseudo
=
new
JTextField
();
JLabel
explication
=
new
JLabel
(
"chercher une partie : "
);
JLabel
idChercherLabel
=
new
JLabel
(
"à partir d'une id : "
);
JTextField
idAChercher
=
new
JTextField
();
JButton
idChercherBouton
=
new
JButton
(
"chercher"
);
JLabel
pseudoChercherLabel
=
new
JLabel
(
"à partir d'un pseudo : "
);
JTextField
pseudoAChercher
=
new
JTextField
();
JButton
pseudoChercherBouton
=
new
JButton
(
"chercher"
);
JList
parties
=
new
JList
();
/*_____Composant du Panel principal_____*/
JPanel
rejoindre
=
new
JPanel
();
JPanel
heberger
=
new
JPanel
();
JPanel
optCarry
=
new
JPanel
();
boolean
customize
=
false
;
boolean
creer
=
false
;
...
...
@@ -38,22 +53,57 @@ public class OptPartie extends JPanel {
//faire une liste des parties initialisées avec le nom dans un label et un bouton rejoindre.
this
.
setBackground
(
appli
.
BACKGROUND_COLOR
);
JPanel
panelPrincipal
=
new
JPanel
(
new
BorderLayout
());
JPanel
principal
=
new
JPanel
(
new
BorderLayout
());
//GridLayout lay = new GridLayout(4,5);
/*____________________panel rejoindre____________________*/
/*____________________panel rejoindre____________________*/
rejoindre
.
setLayout
(
new
BorderLayout
());
JPanel
ecriturePanelWest
=
new
JPanel
();
ecriturePanelWest
.
setLayout
(
new
GridLayout
(
6
,
3
));
ecriturePanelWest
.
add
(
entreePseudoLabel
);
ecriturePanelWest
.
add
(
entreePseudo
);
ecriturePanelWest
.
add
(
new
JPanel
());
ecriturePanelWest
.
add
(
new
JPanel
());
ecriturePanelWest
.
add
(
new
JPanel
());
ecriturePanelWest
.
add
(
new
JPanel
());
ecriturePanelWest
.
add
(
explication
);
ecriturePanelWest
.
add
(
new
JPanel
());
ecriturePanelWest
.
add
(
new
JPanel
());
ecriturePanelWest
.
add
(
idChercherLabel
);
ecriturePanelWest
.
add
(
idAChercher
);
ecriturePanelWest
.
add
(
idChercherBouton
);
ecriturePanelWest
.
add
(
pseudoChercherLabel
);
ecriturePanelWest
.
add
(
pseudoAChercher
);
ecriturePanelWest
.
add
(
pseudoChercherBouton
);
ecriturePanelWest
.
add
(
new
JPanel
());
ecriturePanelWest
.
add
(
new
JPanel
());
rejoindre
.
setLayout
(
new
BorderLayout
());
rejoindre
.
add
(
ecriturePanelWest
,
BorderLayout
.
WEST
);
JPanel
boutonCarryRejoindre
=
new
JPanel
();
boutonCarryRejoindre
.
setLayout
(
new
BoxLayout
(
boutonCarryRejoindre
,
BoxLayout
.
X_AXIS
));
boutonCarryRejoindre
.
add
(
retourMenu
);
boutonCarryRejoindre
.
add
(
retourChoix
);
boutonCarryRejoindre
.
add
(
joinPartie
);
boutonCarryRejoindre
.
add
(
actualiser
);
rejoindre
.
add
(
boutonCarryRejoindre
,
BorderLayout
.
SOUTH
);
rejoindre
.
add
(
parties
,
BorderLayout
.
EAST
);
//player.getName et game.getID + type (belge, fr)
//bouton actualiser
//demander une flotte
rejoindre
.
setVisible
(
false
);
principal
.
add
(
rejoindre
,
BorderLayout
.
WEST
);
/*____________________panel creer____________________*/
/*____________________panel creer____________________*/
heberger
.
setLayout
(
new
GridLayout
());
...
...
@@ -67,19 +117,12 @@ public class OptPartie extends JPanel {
heberger
.
setVisible
(
false
);
principal
.
add
(
heberger
,
BorderLayout
.
EAST
);
/*________fin des layouts________*/
panelPrincipal
.
add
(
principal
);
Dimension
screenSize
=
Toolkit
.
getDefaultToolkit
().
getScreenSize
();
int
width
=
(
int
)
screenSize
.
getWidth
();
int
height
=
(
int
)
screenSize
.
getHeight
();
int
XFenetre
=
this
.
getWidth
();
int
YFenetre
=
this
.
getHeight
();
/*____________________fin des layouts____________________*/
//this.setLocation((width/2 - XFenetre/2), (height/2 - YFenetre/2)
);
this
.
setPreferredSize
(
new
Dimension
(
750
,
200
)
);
//
this.set
IconImage(
);
//
this.set
Background(
);
principal
.
setVisible
(
true
);
this
.
add
(
principal
);
this
.
set
Visible
(
true
);
this
.
set
PreferredSize
(
new
Dimension
(
750
,
400
)
);
}
...
...
@@ -98,6 +141,18 @@ public class OptPartie extends JPanel {
this
.
setName
(
nouveau
);
}
public
String
getPseudoChoisi
(){
return
entreePseudo
.
getText
();
}
public
String
getPseudoChercher
(){
return
pseudoAChercher
.
getText
();
}
public
String
getIdChercher
(){
return
idAChercher
.
getText
();
}
public
void
actualiser
(){
if
(
join
==
true
)
{
...
...
src/info1/application/appli.java
View file @
7d4b0289
...
...
@@ -13,8 +13,6 @@ import info1.network.*;
import
info1.ships.*
;
import
info1.controlleur.*
;
import
java.awt.*
;
public
class
appli
{
private
static
Game
game
;
...
...
@@ -91,7 +89,7 @@ public class appli {
public
static
void
afficherOptPartie
(
boolean
choisit
){
OptPartie
optionsPartie
=
new
OptPartie
(
"Que voulez vous faire ?"
);
if
(
choisit
)
if
(
!
choisit
)
optionsPartie
.
afficherHeberger
();
else
optionsPartie
.
afficherRejoindre
();
...
...
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