TP03 fin ; TP04
This commit is contained in:
BIN
APL2.1/TP03/Piege/Piege.class
Normal file
BIN
APL2.1/TP03/Piege/Piege.class
Normal file
Binary file not shown.
44
APL2.1/TP03/Piege/Piege.java
Normal file
44
APL2.1/TP03/Piege/Piege.java
Normal file
@@ -0,0 +1,44 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Piege {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame("Rose");
|
||||
fenetre.setSize(300, 300);
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.setLayout(null);
|
||||
|
||||
JButton one = new JButton("1");
|
||||
JButton two = new JButton("2");
|
||||
JButton three = new JButton("3");
|
||||
JButton four = new JButton("4");
|
||||
JButton five = new JButton("5");
|
||||
|
||||
int offsetX = 10;
|
||||
int offsetY = 35;
|
||||
|
||||
one.setSize(250 - offsetX, 50);
|
||||
|
||||
two.setSize(50, 250 - offsetY);
|
||||
two.setLocation(250 - offsetX, 0);
|
||||
|
||||
three.setSize(250 - offsetX, 50);
|
||||
three.setLocation(50, 250 - offsetY);
|
||||
|
||||
four.setSize(50, 250 - offsetY);
|
||||
four.setLocation(0, 50);
|
||||
|
||||
five.setSize(200 - offsetX, 200 - offsetY);
|
||||
five.setLocation(50, 50);
|
||||
|
||||
fenetre.add(one);
|
||||
fenetre.add(two);
|
||||
fenetre.add(three);
|
||||
fenetre.add(four);
|
||||
fenetre.add(five);
|
||||
|
||||
fenetre.setResizable(false);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user