ajout vieux sujet

This commit is contained in:
Moncef STITI 2024-03-10 16:28:28 +01:00
parent edc92ac142
commit 42bb92022a
7 changed files with 59 additions and 9 deletions

View File

@ -0,0 +1,3 @@
public class Manie{
}

View File

@ -1,9 +0,0 @@
import javax.swing.*;
import java.awt.*;
public class Nuance {
private JPanel[] tableauPanneauNuance;
public Nuance(){
}
}

View File

@ -0,0 +1,33 @@
import javax.swing.*;
import java.awt.*;
public class Menu {
private JButton[] boutons;
public Menu(String args[]) {
JFrame fenetre = new JFrame();
fenetre.setSize(500,500);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.boutons = new JButton[args.length];
JPanel panneau = new JPanel();
panneau.setLayout(new GridLayout(args.length, 1));
int i = 0;
for (String element : args) {
this.boutons[i] = new JButton(element);
panneau.add(this.boutons[i]);
i++;
}
fenetre.add(panneau);
// Utiliser pack() pour ajuster la taille de la fenêtre en fonction des composants
fenetre.setVisible(true);
}
public static void main(String[] args) {
Menu test = new Menu(args);
}
}

View File

@ -0,0 +1,23 @@
import java.lang.Math;
import java.util.Random;
public class EXO1{
private double valeur1;
private Random random;
private double valeur2;
public EXO1(){
valeur1 = Math.random();
this.random = new Random();
valeur2 = random.nextDouble();
}
public String toString(){
return ""+valeur1+"\n"+valeur2;
}
public static void main(String[] args){
EXO1 test = new EXO1();
System.out.println(test.toString());
}
}