Actualiser src/fr/iutfbleau/papillon/Main.java

This commit is contained in:
2025-10-21 16:49:52 +02:00
parent ef2ee630ef
commit 7318941579
+15 -4
View File
@@ -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();