APL/APL2.1/TP03/Piege/Piege.java

44 lines
1.2 KiB
Java
Raw Normal View History

2022-02-08 17:20:59 +01:00
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);
}
}