finir TP3

This commit is contained in:
Vieira Enzo 2022-02-07 16:15:08 +01:00
parent 47e6f3b0a4
commit 04d989559e
6 changed files with 76 additions and 0 deletions

BIN
APL2.1/TP3/Choix.class Normal file

Binary file not shown.

29
APL2.1/TP3/Choix.java Normal file
View File

@ -0,0 +1,29 @@
import javax.swing.*;
import java.awt.*;
public class Choix {
public static void main(String[] args) {
JFrame fenetre = new JFrame();
fenetre.setSize(500,300);
fenetre.setMinimumSize(new Dimension(300, 200));
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ButtonGroup Cheh = new ButtonGroup();
JRadioButton bouton8 = new JRadioButton("Gryffondor");
Cheh.add (bouton8);
fenetre.add(bouton8, BorderLayout.NORTH);
bouton8.setVerticalAlignment(JLabel.CENTER);
JRadioButton bouton9 = new JRadioButton("Serdaigle");
Cheh.add (bouton9);
fenetre.add(bouton9, BorderLayout.CENTER);
bouton9.setVerticalAlignment(JLabel.CENTER);
JRadioButton bouton10 = new JRadioButton("Serpentard");
Cheh.add (bouton10);
fenetre.add(bouton10, BorderLayout.SOUTH);
bouton10.setVerticalAlignment(JLabel.CENTER);
JRadioButton bouton11 = new JRadioButton("Poufsouffle");
Cheh.add (bouton11);
fenetre.add(bouton11, BorderLayout.EAST);
bouton10.setVerticalAlignment(JLabel.CENTER);
fenetre.setVisible(true);
}
}

BIN
APL2.1/TP3/Damier.class Normal file

Binary file not shown.

26
APL2.1/TP3/Damier.java Normal file
View File

@ -0,0 +1,26 @@
import javax.swing.*;
import java.awt.*;
public class Damier {
public static void main(String[] args) {
JFrame fenetre = new JFrame();
fenetre.setSize(500,300);
fenetre.setMinimumSize(new Dimension(300, 200));
GridLayout gestionnaire = new GridLayout(Integer.parseInt(args[0]), Integer.parseInt(args[0]));
fenetre.setLayout(gestionnaire);
for(int i = 0; i < Integer.parseInt(args[0])*Integer.parseInt(args[0]) ; i++){
JPanel panneau = new JPanel();
if((i%2)==1)
{
panneau.setBackground(Color.white);
fenetre.add(panneau);
}
else
{
panneau.setBackground(Color.cyan);
fenetre.add(panneau);
}
}
fenetre.setVisible(true);
}
}

BIN
APL2.1/TP3/Question.class Normal file

Binary file not shown.

21
APL2.1/TP3/Question.java Normal file
View File

@ -0,0 +1,21 @@
import javax.swing.*;
import java.awt.*;
public class Question {
public static void main(String[] args) {
JFrame fenetre = new JFrame();
fenetre.setSize(500,300);
fenetre.setMinimumSize(new Dimension(300, 200));
GridLayout gestionnaire = new GridLayout(3,3);
fenetre.setLayout(gestionnaire);
JPanel panneau = new JPanel();
JButton bouton = new JButton("Oui");
panneau.add(bouton);
JButton bouton2 = new JButton("Non");
panneau.add(bouton2);
JButton bouton3 = new JButton("NSPP");
panneau.add(bouton3);
fenetre.add(panneau);
fenetre.setVisible(true);
}
}