This commit is contained in:
Emmanuel Srivastava
2025-01-30 15:58:46 +01:00
parent b1fa4d63d9
commit 1859f1cb67
9 changed files with 169 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JTextField;
public class test {
public static void main(String[] args) {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setLayout(new BorderLayout());
JTextField tf = new JTextField();
f.setSize(500, 300);
f.setLocation(500,250);
f.setVisible(true);
}
}

Binary file not shown.

View File

@@ -0,0 +1,33 @@
import javax.swing.*;
import java.awt.*;
public class Choix {
public static void main(String[] args){
JFrame frame = new JFrame("Choix");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GridLayout gestionnaire = new GridLayout(4, 1);
frame.setLayout(gestionnaire);
JRadioButton gryf = new JRadioButton("Gryffondor");
JRadioButton serd = new JRadioButton("Serdaigle");
JRadioButton serp = new JRadioButton("Serpentard");
JRadioButton pouf = new JRadioButton("Poufsouffle");
gryf.setHorizontalAlignment(JRadioButton.CENTER);
serd.setHorizontalAlignment(JRadioButton.CENTER);
serp.setHorizontalAlignment(JRadioButton.CENTER);
pouf.setHorizontalAlignment(JRadioButton.CENTER);
frame.add(gryf);
frame.add(serd);
frame.add(serp);
frame.add(pouf);
frame.setSize(1000,500);
frame.setLocation(500,250);
frame.setVisible(true);
}
}

Binary file not shown.

View File

@@ -0,0 +1,34 @@
import javax.swing.*;
import java.awt.*;
public class Damier {
public static void main(String[] args){
JFrame frame = new JFrame("Damier");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int xpan = Integer.parseInt(args[0]);
int ypan;
ypan = xpan;
GridLayout gestionnaire = new GridLayout(xpan, ypan);
frame.setLayout(gestionnaire);
for(int i = 0; i < xpan*ypan; i++){
if(i % 2 == 0){
JPanel panneau = new JPanel();
panneau.setBackground(Color.WHITE);
frame.add(panneau);
}else{
JPanel panneau = new JPanel();
panneau.setBackground(Color.CYAN);
frame.add(panneau);
}
}
frame.setSize(500,500);
frame.setLocation(500,250);
frame.setVisible(true);
}
}

Binary file not shown.

View File

@@ -0,0 +1,25 @@
import javax.swing.*;
import java.awt.*;
public class Piege {
public static void main(String[] args){
JFrame frame = new JFrame("Piege");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(null);
JButton btn1 = new JButton("1");
btn1.setLocation(1,1);
btn1.setSize(400,50);
JButton btn2 = new JButton("2");
btn2.setLocation(400,1);
btn2.setSize(100,400);
frame.add(btn1);
frame.add(btn2);
frame.setSize(500,500);
frame.setLocation(500,250);
frame.setVisible(true);
}
}

View File

@@ -0,0 +1,27 @@
import javax.swing.*;
import java.awt.*;
public class Question {
public static void main(String[] args){
JFrame frame = new JFrame("Question");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
JLabel etiquette = new JLabel("Aimez-vous les chats ?", SwingConstants.CENTER);
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
JButton btn1 = new JButton("Oui");
JButton btn2 = new JButton("Non");
JButton btn3 = new JButton("NSPP");
buttonPanel.add(btn1);
buttonPanel.add(btn2);
buttonPanel.add(btn3);
frame.add(etiquette, BorderLayout.NORTH);
frame.add(buttonPanel, BorderLayout.SOUTH);
frame.setSize(380,120);
frame.setLocation(500,250);
frame.setVisible(true);
}
}

View File

@@ -0,0 +1,30 @@
import javax.swing.*;
import java.awt.*;
public class Rose {
public static void main(String[] args) {
JFrame frame = new JFrame("Rose");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Créer un panel avec un GridLayout pour organiser les labels
JPanel panel = new JPanel(new GridLayout(0, 1)); // Une colonne, autant de lignes que nécessaire
// Ajouter les labels avec les noms
panel.add(new JLabel("Mystral", SwingConstants.CENTER));
panel.add(new JLabel("Tramontane", SwingConstants.CENTER));
panel.add(new JLabel("Grec", SwingConstants.CENTER));
panel.add(new JLabel("Ponant", SwingConstants.CENTER));
panel.add(new JLabel("Levant", SwingConstants.CENTER));
panel.add(new JLabel("Libeccio", SwingConstants.CENTER));
panel.add(new JLabel("Marin", SwingConstants.CENTER));
panel.add(new JLabel("Sirocco", SwingConstants.CENTER));
// Ajouter le panel à la frame
frame.add(panel, BorderLayout.CENTER);
// Configurer la taille et la position de la frame
frame.setSize(300, 200);
frame.setLocationRelativeTo(null); // Centrer la fenêtre sur l'écran
frame.setVisible(true);
}
}