TP3 DEV.3.2 Luminaicance
This commit is contained in:
97
DEV.3.1/TP/TP3/ex1/TestVue.java
Normal file
97
DEV.3.1/TP/TP3/ex1/TestVue.java
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
import java.awt.*;
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
public class Vue extends JFrame {
|
||||||
|
|
||||||
|
private JButton creer,postit1,postit2,postit3,postit4;
|
||||||
|
private Controleur controleur;
|
||||||
|
|
||||||
|
public Vue() {
|
||||||
|
super("Boutons");
|
||||||
|
this.setSize(500,500);
|
||||||
|
this.setLocationRelativeTo(null);
|
||||||
|
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||||
|
|
||||||
|
this.setLayout(new GridBagLayout());
|
||||||
|
|
||||||
|
this.creer = new JButton("Créer un papillon");
|
||||||
|
this.postit1 = new JButton("Post-it 1");
|
||||||
|
this.postit2 = new JButton("Post-it 2");
|
||||||
|
this.postit3 = new JButton("Post-it 3");
|
||||||
|
this.postit4 = new JButton("Post-it 4");
|
||||||
|
this.controleur = new Controleur();
|
||||||
|
|
||||||
|
// Contrainte du bouton 1 en haut à gauche
|
||||||
|
GridBagConstraints contrainte1 = new GridBagConstraints();
|
||||||
|
contrainte1.gridx = 0;
|
||||||
|
contrainte1.gridy = 0;
|
||||||
|
contrainte1.gridwidth = 2;
|
||||||
|
contrainte1.gridheight = 1;
|
||||||
|
contrainte1.fill = GridBagConstraints.BOTH;
|
||||||
|
contrainte1.anchor = GridBagConstraints.CENTER;
|
||||||
|
contrainte1.weightx = 1.0;
|
||||||
|
contrainte1.weighty = 1.0;
|
||||||
|
contrainte1.insets = new Insets(3,3,3,3);
|
||||||
|
|
||||||
|
this.add(this.creer, contrainte1);
|
||||||
|
|
||||||
|
// Contrainte du bouton 2 en haut à droite
|
||||||
|
GridBagConstraints contrainte2 = new GridBagConstraints();
|
||||||
|
contrainte2.gridx = 0;
|
||||||
|
contrainte2.gridy = 1;
|
||||||
|
contrainte2.gridwidth = 1;
|
||||||
|
contrainte2.gridheight = 1;
|
||||||
|
contrainte2.fill = GridBagConstraints.BOTH;
|
||||||
|
contrainte2.anchor = GridBagConstraints.CENTER;
|
||||||
|
contrainte2.weightx = 1.0;
|
||||||
|
contrainte2.weighty = 1.0;
|
||||||
|
contrainte2.insets = new Insets(5,5,5,10);
|
||||||
|
|
||||||
|
this.add(this.postit1, contrainte2);
|
||||||
|
|
||||||
|
// Contrainte du bouton 3 en bas à droite
|
||||||
|
GridBagConstraints contrainte3 = new GridBagConstraints();
|
||||||
|
contrainte3.gridx = 1;
|
||||||
|
contrainte3.gridy = 1;
|
||||||
|
contrainte3.gridwidth = 1;
|
||||||
|
contrainte3.gridheight = 1;
|
||||||
|
contrainte3.fill = GridBagConstraints.BOTH;
|
||||||
|
contrainte3.anchor = GridBagConstraints.CENTER;
|
||||||
|
contrainte3.weightx = 1.0;
|
||||||
|
contrainte3.weighty = 1.0;
|
||||||
|
contrainte3.insets = new Insets(5,10,5,5);
|
||||||
|
|
||||||
|
this.add(this.postit2, contrainte3);
|
||||||
|
|
||||||
|
// Contrainte du bouton 4 en bas à gauche
|
||||||
|
GridBagConstraints contrainte4 = new GridBagConstraints();
|
||||||
|
contrainte4.gridx = 0;
|
||||||
|
contrainte4.gridy = 2;
|
||||||
|
contrainte4.gridwidth = 1;
|
||||||
|
contrainte4.gridheight = 1;
|
||||||
|
contrainte4.fill = GridBagConstraints.BOTH;
|
||||||
|
contrainte4.anchor = GridBagConstraints.CENTER;
|
||||||
|
contrainte4.weightx = 1.0;
|
||||||
|
contrainte4.weighty = 1.0;
|
||||||
|
contrainte4.insets = new Insets(5,5,10,5);
|
||||||
|
|
||||||
|
this.add(this.postit3, contrainte4);
|
||||||
|
|
||||||
|
// Contraite du bouton 5 au milieu
|
||||||
|
GridBagConstraints contrainte5 = new GridBagConstraints();
|
||||||
|
contrainte5.gridx = 1;
|
||||||
|
contrainte5.gridy = 2;
|
||||||
|
contrainte5.gridwidth = 1;
|
||||||
|
contrainte5.gridheight = 1;
|
||||||
|
contrainte5.fill = GridBagConstraints.BOTH;
|
||||||
|
contrainte5.anchor = GridBagConstraints.CENTER;
|
||||||
|
contrainte5.weightx = 0.0;
|
||||||
|
contrainte5.weighty = 0.0;
|
||||||
|
contrainte5.insets = new Insets(5,10,5,5);
|
||||||
|
this.add(this.postit4, contrainte5);
|
||||||
|
|
||||||
|
this.addWindowListener(this.controleur);
|
||||||
|
|
||||||
|
this.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
0
DEV.3.2/TP/TP3-Listes/1.Luminance/Luminance.java
Normal file
0
DEV.3.2/TP/TP3-Listes/1.Luminance/Luminance.java
Normal file
0
DEV.3.2/TP/TP3-Listes/1.Luminance/Main.java
Normal file
0
DEV.3.2/TP/TP3-Listes/1.Luminance/Main.java
Normal file
Reference in New Issue
Block a user