Java
This commit is contained in:
28
DEV2.1/TP03/TP03_reponses.txt
Normal file
28
DEV2.1/TP03/TP03_reponses.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
1.
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
|
||||
fenetre.setSize(500,500);
|
||||
fenetre.setLocation(100,100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
GridLayout layout = new GridLayout(4,1);
|
||||
fenetre.setLayout(layout);
|
||||
|
||||
fenetre.add(new JRadioButton("Gryffondor"));
|
||||
fenetre.add(new JRadioButton("Serpentard"));
|
||||
fenetre.add(new JRadioButton("Serdaigle"));
|
||||
fenetre.add(new JRadioButton("Poufsouffle"));
|
||||
|
||||
fenetre.setVisible(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
2.
|
||||
|
BIN
DEV2.1/TP03/Test.class
Normal file
BIN
DEV2.1/TP03/Test.class
Normal file
Binary file not shown.
32
DEV2.1/TP03/Test.java
Normal file
32
DEV2.1/TP03/Test.java
Normal file
@@ -0,0 +1,32 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
int a = Integer.parseInt(args[0]);
|
||||
|
||||
fenetre.setSize(500,500);
|
||||
fenetre.setLocation(100,100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
GridLayout layout = new GridLayout(a,a);
|
||||
fenetre.setLayout(layout);
|
||||
|
||||
for(int i = 0; i < a*a; i++) {
|
||||
JPanel panneau = new JPanel();
|
||||
if (i%2 == 0) {
|
||||
panneau.setBackground(Color.WHITE);
|
||||
}
|
||||
else {
|
||||
panneau.setBackground(Color.CYAN);
|
||||
}
|
||||
fenetre.add(panneau);
|
||||
}
|
||||
|
||||
|
||||
|
||||
fenetre.setVisible(true);
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user