Ajout des exo 2 et 3 du TP4

This commit is contained in:
2024-02-18 15:18:07 +01:00
parent 18e7e6cc7f
commit dc767c9f72
71 changed files with 128 additions and 296 deletions

Binary file not shown.

View File

@@ -0,0 +1,30 @@
import javax.swing.*;
import java.awt.*;
public class exo2 {
public static void main(String[] args) {
// un objet pour servir de fenetre
JFrame fenetre = new JFrame();
// on configure la fenetre
fenetre.setSize(1200, 900); /*500px x 300px*/
fenetre.setLocation(100, 100); /*position en haut à gauche*/
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton bouton1 = new JButton("Boutonnnnnnnnnnnnnnnnnnnnnnnnnnnnnn n°1");
JButton bouton2 = new JButton("Boutonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn n°2");
JButton bouton3 = new JButton("Bouton n°3");
JButton bouton4 = new JButton("Bouton n°4");
JButton bouton5 = new JButton("Bouton n°5");
/*Les boutons s'adaptent en fonction de leurs positions sur la fenêtre.
Quand on redimensionne la fenêtre, les boutons rapticissent en mode responsif css*/
fenetre.add(bouton1, BorderLayout.NORTH);
fenetre.add(bouton2, BorderLayout.WEST);
fenetre.add(bouton3, BorderLayout.SOUTH);
fenetre.add(bouton4, BorderLayout.EAST);
fenetre.add(bouton5, BorderLayout.CENTER);
fenetre.setVisible(true);
}
}