Java
This commit is contained in:
27
DEV2.1/TP02/Choix.java
Normal file
27
DEV2.1/TP02/Choix.java
Normal file
@@ -0,0 +1,27 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Choix {
|
||||
public static void main(String[] args) {
|
||||
// un objet pour servir de fenetre
|
||||
JFrame fenetre = new JFrame();
|
||||
// on configure la fenetre
|
||||
fenetre.setSize(500, 300);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
JRadioButton radio1 = new JRadioButton("Gryffondor");
|
||||
JRadioButton radio2 = new JRadioButton("Serdaigle");
|
||||
JRadioButton radio3 = new JRadioButton("Serpentard");
|
||||
|
||||
radio1.setHorizontalAlignment(JRadioButton.CENTER);
|
||||
radio2.setHorizontalAlignment(JRadioButton.CENTER);
|
||||
radio3.setHorizontalAlignment(JRadioButton.CENTER);
|
||||
|
||||
fenetre.add(radio1, BorderLayout.NORTH);
|
||||
fenetre.add(radio2, BorderLayout.CENTER);
|
||||
fenetre.add(radio3, BorderLayout.SOUTH);
|
||||
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user