derniere modfi
This commit is contained in:
parent
92c3b7d56a
commit
c5ba647f68
@ -32,13 +32,12 @@ public class JeuSalle extends JFrame implements KeyListener,ActionListener{
|
||||
setLocationRelativeTo(null);
|
||||
setResizable(false);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
//setContentPane(ecrire("test"));
|
||||
//JScrollPane test = new JScrollPane();
|
||||
//setContentPane(test);
|
||||
|
||||
this.setVisible(true);
|
||||
|
||||
|
||||
}
|
||||
/*Méthode permettant d'écrire du texte dans la fenetre de jeu*/
|
||||
public JPanel ecrire(String str) {
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new FlowLayout());
|
||||
@ -48,7 +47,6 @@ public class JeuSalle extends JFrame implements KeyListener,ActionListener{
|
||||
this.setContentPane(panel);
|
||||
this.addKeyListener(this);
|
||||
this.requestFocus();
|
||||
//this.menu = new Menu();
|
||||
this.setVisible(true);
|
||||
return panel;
|
||||
}
|
||||
@ -57,14 +55,8 @@ public class JeuSalle extends JFrame implements KeyListener,ActionListener{
|
||||
*/
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
//System.out.println("keyPressed");
|
||||
int codeint =e.getKeyCode();
|
||||
|
||||
|
||||
//int codeint=Character.getNumericValue(e.getKeyText(code));
|
||||
//System.out.println(codeint);
|
||||
//String key =e.getKeyText(code);
|
||||
//System.out.println(key);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -78,13 +70,13 @@ public class JeuSalle extends JFrame implements KeyListener,ActionListener{
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)
|
||||
Entrer du clavier
|
||||
*/
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
nb = e.getKeyChar();
|
||||
System.out.println(nb);
|
||||
//System.out.println(nb);
|
||||
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
@ -97,10 +89,12 @@ public class JeuSalle extends JFrame implements KeyListener,ActionListener{
|
||||
|
||||
|
||||
}
|
||||
/*Méthode qui récupère les entrés de type int du clavier*/
|
||||
public int toucheint() {
|
||||
System.out.println("sortie"+nb);
|
||||
return nb;
|
||||
}
|
||||
/*Méthode que permet de cacher un texte affiché dans la fenetre*/
|
||||
public void cacher(JPanel panel) {
|
||||
panel.setVisible(false);
|
||||
}
|
||||
|
@ -49,7 +49,6 @@ public class jeu extends JFrame implements ActionListener {
|
||||
|
||||
public jeu() throws IOException {
|
||||
super();
|
||||
|
||||
build();
|
||||
this.menu=new Menu();
|
||||
}
|
||||
@ -61,10 +60,10 @@ public class jeu extends JFrame implements ActionListener {
|
||||
setResizable(false);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
|
||||
//Création du JLabel pour l'image
|
||||
JLabel container = new JLabel(new ImageIcon(this.image()));
|
||||
|
||||
|
||||
//Création du layout des boutons
|
||||
container.setLayout(new GridBagLayout());
|
||||
|
||||
|
||||
@ -91,6 +90,7 @@ public class jeu extends JFrame implements ActionListener {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||||
Récupération des évènements des boutons Nouvelle Partie et Contnuer
|
||||
*/
|
||||
@Override
|
||||
|
||||
@ -98,52 +98,21 @@ public class jeu extends JFrame implements ActionListener {
|
||||
Object source=arg0.getSource();
|
||||
choix(source);
|
||||
|
||||
//if(source==nouvelle) {
|
||||
//JPanel panel = new JPanel();
|
||||
/*Menu menu = new Menu();
|
||||
Labyrinthe lab=menu.nouvellePartie();
|
||||
JeuSalle salle = new JeuSalle();
|
||||
|
||||
repaint();
|
||||
|
||||
Personnage perso = menu.menuSelection(lab, salle);
|
||||
panel =salle.ecrire(menu.textePerso(lab));
|
||||
int test =1;
|
||||
if(perso!=null) {
|
||||
panel.setVisible(false);
|
||||
repaint();
|
||||
System.out.println("test");
|
||||
|
||||
Marche marche= (Marche) lab.listePorte.get(0).getSalle1();
|
||||
panel =salle.ecrire(marche.creerObjetsAVendre(lab));
|
||||
}
|
||||
|
||||
//menu.Menu_Marche(marche, perso, lab);
|
||||
/*
|
||||
//Bug
|
||||
|
||||
//System.out.println();
|
||||
|
||||
//salle.cacher(panel);
|
||||
//menu.menuSelection(lab);
|
||||
|
||||
}
|
||||
if(source==continuer) {
|
||||
Menu menu = new Menu();
|
||||
Labyrinthe lab = menu.continuer();
|
||||
}*/
|
||||
|
||||
}
|
||||
/*Méthode de traitement des actions sur les boutons*/
|
||||
public void choix(Object source) {
|
||||
|
||||
if(source==nouvelle) {
|
||||
System.out.println("1");
|
||||
|
||||
//menu =new Menu();
|
||||
//Création du Labyrinthe
|
||||
Labyrinthe lab =new Labyrinthe();
|
||||
|
||||
|
||||
this.menu.getJs().setLab(lab) ;
|
||||
//
|
||||
this.menu.getJs().setLab(lab);
|
||||
//Appel de la méthode menuSelection()
|
||||
this.menu.menuSelection(this.menu.getJs().getLab());
|
||||
}
|
||||
if(source==continuer) {
|
||||
@ -156,10 +125,7 @@ public class jeu extends JFrame implements ActionListener {
|
||||
|
||||
|
||||
}
|
||||
/* public Menu creersalle() {
|
||||
salle = new Menu();
|
||||
return salle;
|
||||
}*/
|
||||
|
||||
public Menu getMenu() {
|
||||
return menu;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user