wow le tp là

This commit is contained in:
Simoes Lukas
2025-09-04 15:36:55 +02:00
parent c16ef0985f
commit 2c3e150ec5
87 changed files with 1059 additions and 28 deletions

Binary file not shown.

View File

@@ -0,0 +1,64 @@
import java.awt.*;
import javax.swing.*;
public class Fenetre extends JFrame {
public Fenetre() {
this.setSize(300, 200);
this.setLocation(100, 100);
GridBagLayout layout = new GridBagLayout();
this.setLayout(layout);
GridBagConstraints gbc = new GridBagConstraints();
JButton b1 = new JButton("1");
JButton b2 = new JButton("2");
JButton b3 = new JButton("3");
JButton b4 = new JButton("4");
JButton b5 = new JButton("5");
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 2;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
this.add(b1, gbc);
gbc.gridx = 2;
gbc.gridy = 0;
gbc.gridwidth = 1;
gbc.gridheight = 2;
this.add(b2, gbc);
gbc.gridx = 1;
gbc.gridy = 2;
gbc.gridwidth = 2;
gbc.gridheight = 1;
this.add(b3, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 1;
gbc.gridheight = 2;
this.add(b4, gbc);
gbc.gridx = 1;
gbc.gridy = 1;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
this.add(b5, gbc);
this.addWindowListener(new WindowControler(this));
}
}

Binary file not shown.

View File

@@ -0,0 +1,6 @@
public class Main {
public static void main(String[] args) {
Fenetre fenetre = new Fenetre();
fenetre.setVisible(true);
}
}

Binary file not shown.

View File

@@ -0,0 +1,50 @@
import java.awt.*;
import javax.swing.*;
import java.awt.event.WindowListener;
import java.awt.event.WindowEvent;
public class WindowControler implements WindowListener {
private Fenetre fenetre;
public WindowControler(Fenetre fenetre) {
this.fenetre = fenetre;
}
public void windowActivated(WindowEvent evenement) {
}
public void windowClosed(WindowEvent evenement) {
}
public void windowClosing(WindowEvent evenement) {
int resultat = JOptionPane.showConfirmDialog(fenetre, null);
if (resultat == JOptionPane.YES_OPTION) {
fenetre.dispose();
}
} // avant fermeture
public void windowDeactivated(WindowEvent evenement) {
}
public void windowDeiconified(WindowEvent evenement) {
}
public void windowIconified(WindowEvent evenement) {
}
public void windowOpened(WindowEvent evenement) {
}
}