1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
package vue;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Vue_Recherche extends JFrame{
public Vue_Recherche(){
//Titre de la fenêtre
super("Voir || Rechercher");
//Taille fenêtre
this.setSize(300,150);
//Redimension de la fenetre False
this.setResizable(false);
//Récupérer taille écran
Dimension d1 = this.getToolkit().getScreenSize();
//Récupérer taille fenêtre
Dimension d2 = this.getSize();
//Positioner la fenêtre au centre
this.setLocation(d1.width/2 - d2.width/2, d1.height/2 - d2.height/2);
//Un dispose qui fait joli... est-il nécessaire ? J'en sais rien
this.dispose();
this.add(new Recherche());
}
public Vue_Recherche(boolean bool){
if(bool == true){
this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
}
}
class Recherche extends JPanel{
public Recherche(){
OK ok = new OK();
Cancel cancel = new Cancel();
cancel.fermer();
this.setLayout(new BorderLayout());
JLabel text = new JLabel("Veuillez saisir le code client OU le nom");
//this.add(text, BorderLayout.NORTH);
JPanel Text = new JPanel();
Text.setLayout(new FlowLayout());
Text.add(text);
this.add(Text, BorderLayout.NORTH);
JLabel code = new JLabel("Code client :");
//this.add(code);
JTextField txtCode = new JTextField();
//txtCode.setPreferredSize(new Dimension(100,25));
//this.add(txtCode);
JLabel nom = new JLabel("Nom :");
//this.add(nom , BorderLayout.SOUTH);
JTextField txtNom = new JTextField();
//txtNom.setPreferredSize(new Dimension(100,25));
//this.add(txtNom , BorderLayout.CENTER);
JPanel Grille = new JPanel();
Grille.setLayout(new GridLayout(3,2,5,5));
Grille.add(code);
Grille.add(txtCode);
Grille.add(nom);
Grille.add(txtNom);
Grille.add(ok);
Grille.add(cancel);
this.add(Grille, BorderLayout.CENTER);
}
}
} |
Partager