Ajout des exo 2 et 3 du TP4
This commit is contained in:
BIN
BUT1/DEV2.1/TP2-ComposantsGraphique/EXO4/exo4.class
Normal file
BIN
BUT1/DEV2.1/TP2-ComposantsGraphique/EXO4/exo4.class
Normal file
Binary file not shown.
32
BUT1/DEV2.1/TP2-ComposantsGraphique/EXO4/exo4.java
Normal file
32
BUT1/DEV2.1/TP2-ComposantsGraphique/EXO4/exo4.java
Normal file
@@ -0,0 +1,32 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class exo4 {
|
||||
public static void main(String[] args) {
|
||||
// un objet pour servir de fenetre
|
||||
JFrame fenetre = new JFrame();
|
||||
|
||||
// on configure la fenetre
|
||||
fenetre.setSize(1200, 1000);
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
// On crée une zone de texte
|
||||
JRadioButton boutonRadio1 = new JRadioButton("Gryffondor");
|
||||
JRadioButton boutonRadio2 = new JRadioButton("Serdaigle");
|
||||
JRadioButton boutonRadio3 = new JRadioButton("Serpentard");
|
||||
|
||||
ButtonGroup Groupe = new ButtonGroup();
|
||||
Groupe.add(boutonRadio1);
|
||||
Groupe.add(boutonRadio2);
|
||||
Groupe.add(boutonRadio3);
|
||||
|
||||
// on ajoute le composant dans la fenetre, au milieu
|
||||
fenetre.add(boutonRadio1,BorderLayout.NORTH);
|
||||
fenetre.add(boutonRadio2,BorderLayout.CENTER);
|
||||
fenetre.add(boutonRadio3,BorderLayout.SOUTH);
|
||||
|
||||
// et on montre le resultat
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user