maj
This commit is contained in:
parent
8723822304
commit
97ca073fdd
Binary file not shown.
@ -3,30 +3,22 @@ import java.awt.*;
|
|||||||
|
|
||||||
public class exo3 {
|
public class exo3 {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
JFrame fenetre = new JFrame();
|
JFrame fenetre = new JFrame("Exo3");
|
||||||
fenetre.setSize(500, 300);
|
fenetre.setSize(200, 200);
|
||||||
fenetre.setLocation(300, 300);
|
fenetre.setLocation(0, 0);
|
||||||
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
JPanel panneauBouton = new JPanel();
|
FlowLayout flow = new FlowLayout(FlowLayout.CENTER);
|
||||||
JPanel panneauPrincipal = new JPanel();
|
fenetre.setLayout(flow);
|
||||||
|
JLabel panel = new JLabel("Aimez-vous les chiens ?");
|
||||||
|
panel.setPreferredSize(new Dimension(486, 20));
|
||||||
JLabel texte = new JLabel("Aimez-vous les chiens ?");
|
panel.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
JButton yes = new JButton("Oui");
|
||||||
|
JButton no = new JButton("Non");
|
||||||
JButton bouton1 = new JButton("Oui");
|
JButton maybe = new JButton("NSPP");
|
||||||
panneauBouton.add(bouton1);
|
fenetre.add(panel);
|
||||||
JButton bouton2 = new JButton("Non");
|
fenetre.add(yes);
|
||||||
panneauBouton.add(bouton2);
|
fenetre.add(no);
|
||||||
JButton bouton3 = new JButton("NSPP");
|
fenetre.add(maybe);
|
||||||
panneauBouton.add(bouton3);
|
|
||||||
|
|
||||||
panneauPrincipal.add(texte, BorderLayout.CENTER);
|
|
||||||
panneauPrincipal.add(panneauBouton, BorderLayout.SOUTH);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fenetre.add(panneauPrincipal, BorderLayout.CENTER);
|
|
||||||
fenetre.setVisible(true);
|
fenetre.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
@ -3,12 +3,63 @@ import java.awt.*;
|
|||||||
|
|
||||||
public class exo4 {
|
public class exo4 {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
JFrame fenetre = new JFrame();
|
JFrame fenetre = new JFrame("Exo4");
|
||||||
fenetre.setSize(600,400);
|
fenetre.setSize(500, 500);
|
||||||
fenetre.setLocation(300,300);
|
fenetre.setLocation(0, 0);
|
||||||
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
GridLayout gestionnaire = new GridLayout(3, 1);
|
||||||
|
fenetre.setLayout(gestionnaire);
|
||||||
|
|
||||||
|
JLabel texte1 = new JLabel("Mystral");
|
||||||
|
JLabel texte2 = new JLabel("texte2");
|
||||||
|
JLabel texte3 = new JLabel("texte3");
|
||||||
|
JLabel texte4 = new JLabel("texte4");
|
||||||
|
JLabel texte5 = new JLabel("texte5");
|
||||||
|
JLabel texte6 = new JLabel("texte6");
|
||||||
|
JLabel texte7 = new JLabel("texte7");
|
||||||
|
JLabel texte8 = new JLabel("texte8");
|
||||||
|
|
||||||
|
// Texte n°1 :
|
||||||
|
texte1.setHorizontalAlignment(JLabel.LEFT);
|
||||||
|
texte1.setVerticalAlignment(JLabel.TOP);
|
||||||
|
|
||||||
|
// Texte n°2 :
|
||||||
|
texte2.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
texte2.setVerticalAlignment(JLabel.TOP);
|
||||||
|
|
||||||
|
// Texte n°3 :
|
||||||
|
texte3.setHorizontalAlignment(JLabel.RIGHT);
|
||||||
|
texte3.setVerticalAlignment(JLabel.TOP);
|
||||||
|
|
||||||
|
// Texte n°4 :
|
||||||
|
texte4.setHorizontalAlignment(JLabel.LEFT);
|
||||||
|
texte4.setVerticalAlignment(JLabel.CENTER);
|
||||||
|
|
||||||
|
// Texte n°5 :
|
||||||
|
texte5.setHorizontalAlignment(JLabel.RIGHT);
|
||||||
|
texte5.setVerticalAlignment(JLabel.CENTER);
|
||||||
|
|
||||||
|
// Texte n°6 :
|
||||||
|
texte6.setHorizontalAlignment(JLabel.LEFT);
|
||||||
|
texte6.setVerticalAlignment(JLabel.BOTTOM);
|
||||||
|
|
||||||
|
// Texte n°7 :
|
||||||
|
texte7.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
texte7.setVerticalAlignment(JLabel.BOTTOM);
|
||||||
|
|
||||||
|
// Texte n°8 :
|
||||||
|
texte8.setHorizontalAlignment(JLabel.RIGHT);
|
||||||
|
texte8.setVerticalAlignment(JLabel.BOTTOM);
|
||||||
|
|
||||||
|
fenetre.add(texte1);
|
||||||
|
fenetre.add(texte2);
|
||||||
|
fenetre.add(texte3);
|
||||||
|
fenetre.add(texte4);
|
||||||
|
fenetre.add(texte5);
|
||||||
|
fenetre.add(texte6);
|
||||||
|
fenetre.add(texte7);
|
||||||
|
fenetre.add(texte8);
|
||||||
|
|
||||||
GridLayout gestionnaire = new GridLayout(3,0);
|
|
||||||
|
|
||||||
fenetre.setVisible(true);
|
fenetre.setVisible(true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user