diff --git a/src/fr/iutfbleau/papillon/Main.java b/src/fr/iutfbleau/papillon/Main.java index 92277b0..9407483 100644 --- a/src/fr/iutfbleau/papillon/Main.java +++ b/src/fr/iutfbleau/papillon/Main.java @@ -9,7 +9,7 @@ public class Main extends JFrame { super("Papillon"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - // ----- Titre en haut ----- + // Titre en haut JLabel titre = new JLabel("Rappel : Papillon", SwingConstants.CENTER); titre.setBorder(BorderFactory.createEmptyBorder(6,10,6,10)); titre.setBackground(Color.CYAN); @@ -75,10 +75,21 @@ public class Main extends JFrame { } -public void setFenetre(){ -FenetreAjout update = new FenetreAjout(); -update.setVisible(true); + + +public void ouvrirFenetreAjout() { + FenetreAjout f = new FenetreAjout(this); + // cacher la fenetre actuelle et montrer celle d ajout + + // récupère la position actuelle de Main + Point pos = this.getLocation(); + f.setLocation(pos); // place FenetreAjout au même endroit + + f.setVisible(true); + this.setVisible(false); + } + public static void main(String[] args) { Main f = new Main();