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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
package test;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
public class vueTest extends JFrame{
/**
*
*/
private static final long serialVersionUID = 1L;
private JList pan;
private JLabel lab;
private JLabel lab2;
private JButton connect;
private JButton valid;
private JButton affiche;
private JButton download;
private JButton disco;
private JButton quitter;
private JTextField field;
private JTextField field2;
public vueTest(){
this.setLayout(new BorderLayout());
this.setSize(750,490);
this.setTitle("test Composant");
this.setResizable(false);
//**************
// la liste CENTER
//**************
Vector<String> vec = new Vector<String>();
for(int i = 0;i<50;i++)
vec.add(" ");
pan = new JList(vec);
JScrollPane scroll = new JScrollPane(pan);
//****************************
// les infos disponible EAST
//****************************
// les saisies Utilisateur
JPanel panInfoSaisie = new JPanel();
panInfoSaisie.setLayout(new GridLayout(9,2));
lab = new JLabel(" - Utilisateur :");
lab2 = new JLabel(" - Password :");
field = new JTextField(8);
field2 = new JTextField(8);
panInfoSaisie.add(lab);
panInfoSaisie.add(field);
panInfoSaisie.add(lab2);
panInfoSaisie.add(field2);
panInfoSaisie.add(new JLabel(""));
panInfoSaisie.add(new JLabel(""));
panInfoSaisie.add(new JLabel(""));
panInfoSaisie.add(new JLabel(""));
panInfoSaisie.add(new JLabel(""));
panInfoSaisie.add(new JLabel(""));
panInfoSaisie.add(new JLabel(""));
//************************************************
// LES BOUTONS + PANEL POUR LA DIMENSION DANS LA GRID
//************************************************
//Controleur bouton = new Controleur();
JPanel panInfo = new JPanel();
panInfo.setLayout(new GridLayout(7,1));
panInfo.setPreferredSize(new Dimension(300,100));
JPanel temp = new JPanel();
connect = new JButton(" Concect ");
//connect.addActionListener(bouton);
temp.add(connect);
JPanel temp2 = new JPanel();
valid = new JButton(" Valid ");
//valid.addActionListener(bouton);
valid.setEnabled(false);
temp2.add(valid);
JPanel temp3 = new JPanel();
affiche = new JButton(" Affiche ");
//affiche.addActionListener(bouton);
affiche.setEnabled(false);
temp3.add(affiche);
JPanel temp4 = new JPanel();
download = new JButton("Download");
//download.addActionListener(bouton);
download.setEnabled(false);
temp4.add(download);
JPanel temp5 = new JPanel();
disco = new JButton(" Disco ");
//disco.addActionListener(bouton);
disco.setEnabled(false);
temp5.add(disco);
JPanel temp6 = new JPanel();
quitter = new JButton(" Quitter ");
//quitter.addActionListener(bouton);
temp6.add(quitter);
// on ajoute de le panel grid
panInfo.add(temp);
panInfo.add(temp2);
panInfo.add(temp3);
panInfo.add(temp4);
panInfo.add(temp5);
panInfo.add(temp6);
// on ajout les 2 panneau
JPanel panneauControle = new JPanel();
panneauControle.setLayout(new GridLayout(2,1));
panneauControle.add(panInfoSaisie);
panneauControle.add(panInfo);
// on fait un split pour le jolie
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,null,panneauControle);
splitPane.setOneTouchExpandable(false);
splitPane.setDividerSize(10);
splitPane.setBackground(Color.lightGray);
splitPane.setResizeWeight(0.8);
// on ajoute le tout dans la fenêtre
this.add(scroll,BorderLayout.CENTER);
this.add(splitPane,BorderLayout.EAST);
//On quitte l'application quand la fenêtre est fermée
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public JTextField getUtilisateur(){
return field;
}
public JTextField getPass(){
return field2;
}
} |