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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
| package Test;
import java.awt.Dimension;
import java.util.*;
import java.util.logging.*;
import javax.swing.*;
import sun.audio.AudioPlayer;
/**
*
* @author GRESLON Jérémy
*/
public class GestionSystemeGardien extends javax.swing.JFrame {
/** Creates new form Integration */
public GestionSystemeGardien() {
initComponents();
AxisCamera cam = new AxisCamera();
jPanelCam.add(cam);
//centrage de la fenêtre
Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
this.pack();
this.setLocation((screenSize.width - this.getWidth()) / 2, (screenSize.height - this.getHeight()) / 2);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanelPhoto = new javax.swing.JPanel();
jButtonBadge = new javax.swing.JButton();
jPanelCam = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jPanelAlarme = new javax.swing.JPanel();
jButtonAlarme = new javax.swing.JButton();
jLabelAutorisation = new javax.swing.JLabel();
jToggleButtonPorte = new javax.swing.JToggleButton();
jSeparator1 = new javax.swing.JSeparator();
jLabel4 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jTextFieldAutorisation = new javax.swing.JTextField();
jTextFieldNumBadge = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanelPhoto.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
javax.swing.GroupLayout jPanelPhotoLayout = new javax.swing.GroupLayout(jPanelPhoto);
jPanelPhoto.setLayout(jPanelPhotoLayout);
jPanelPhotoLayout.setHorizontalGroup(
jPanelPhotoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 294, Short.MAX_VALUE)
);
jPanelPhotoLayout.setVerticalGroup(
jPanelPhotoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 276, Short.MAX_VALUE)
);
jButtonBadge.setText("Passage du badge");
jButtonBadge.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonBadgeActionPerformed(evt);
}
});
jPanelCam.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
javax.swing.GroupLayout jPanelCamLayout = new javax.swing.GroupLayout(jPanelCam);
jPanelCam.setLayout(jPanelCamLayout);
jPanelCamLayout.setHorizontalGroup(
jPanelCamLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 297, Short.MAX_VALUE)
);
jPanelCamLayout.setVerticalGroup(
jPanelCamLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 276, Short.MAX_VALUE)
);
jLabel1.setText("Caméra extérieure:");
jLabel2.setText("Photo de l'utilisateur:");
jPanelAlarme.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
javax.swing.GroupLayout jPanelAlarmeLayout = new javax.swing.GroupLayout(jPanelAlarme);
jPanelAlarme.setLayout(jPanelAlarmeLayout);
jPanelAlarmeLayout.setHorizontalGroup(
jPanelAlarmeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 105, Short.MAX_VALUE)
);
jPanelAlarmeLayout.setVerticalGroup(
jPanelAlarmeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
jButtonAlarme.setText("Alarme");
jButtonAlarme.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonAlarmeActionPerformed(evt);
}
});
jLabelAutorisation.setText("La porte est fermée");
jToggleButtonPorte.setText("Ouverture/Fermeture porte");
jToggleButtonPorte.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jToggleButtonPorteActionPerformed(evt);
}
});
jLabel4.setText("Simulation de la porte d'entrée:");
jLabel3.setText("Intervention de la sécurité:");
jTextFieldNumBadge.setEditable(false);
jTextFieldNumBadge.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextFieldNumBadgeActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(122, 122, 122)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanelCam, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextFieldNumBadge, javax.swing.GroupLayout.DEFAULT_SIZE, 347, Short.MAX_VALUE)
.addComponent(jTextFieldAutorisation, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 347, Short.MAX_VALUE)
.addComponent(jLabel1)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(63, 63, 63)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanelPhoto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGap(80, 80, 80)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanelAlarme, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jButtonAlarme, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(66, 66, 66))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 54, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jToggleButtonPorte, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jSeparator1)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabelAutorisation, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(36, 36, 36)))
.addContainerGap(19, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 264, Short.MAX_VALUE)
.addComponent(jLabel3)
.addGap(76, 76, 76))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(140, 140, 140)
.addComponent(jButtonBadge, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(340, 340, 340))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(42, 42, 42)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanelAlarme, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonAlarme, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel4)
.addGap(18, 18, 18)
.addComponent(jLabelAutorisation, javax.swing.GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jToggleButtonPorte))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanelCam, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanelPhoto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 30, Short.MAX_VALUE)
.addComponent(jTextFieldNumBadge, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(3, 3, 3)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButtonBadge)
.addComponent(jTextFieldAutorisation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
pack();
}// </editor-fold>
private void jButtonBadgeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
GestionBdD BdD = new GestionBdD();
BdD.Connection();
//Connexion FTP
GestionDownloadPhoto test = new GestionDownloadPhoto();
test.Connexion("127.0.0.1", 21); //hôte + port auquel on veut se connecter
//Affichage de la photo dans le panel
ImageIcon icone = new ImageIcon("C:\\Documents and Settings\\GRESLON Jérémy\\Mes documents\\Photos_telechargees\\25.jpg");
JLabel photo = new JLabel (icone);
photo.setSize(jPanelPhoto.getWidth(), jPanelPhoto.getHeight());
jPanelPhoto.add(photo);
jPanelPhoto.repaint();
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
try {
GestionSonore audioPlayer = new GestionSonore("file:/C:/Documents and Settings/GRESLON Jérémy/Mes documents/Photos_employes/Windows XP Démarrage.wav");
audioPlayer.start();
} catch (Exception ex) {
Logger.getLogger(AudioPlayer.class.getName()).log(Level.SEVERE, null, ex);
} //GestionSonore
}
private void jButtonAlarmeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jToggleButtonPorteActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
GestionPortique porte = new GestionPortique();
AbstractButton bouton = (AbstractButton) evt.getSource();
boolean selected = bouton.getModel().isSelected();
if (selected) {
porte.PorteOuverte();
} else {
porte.PorteFermee();
}
}
private void jTextFieldNumBadgeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new GestionSystemeGardien().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButtonAlarme;
private javax.swing.JButton jButtonBadge;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
public static javax.swing.JLabel jLabelAutorisation;
private javax.swing.JPanel jPanelAlarme;
private javax.swing.JPanel jPanelCam;
private javax.swing.JPanel jPanelPhoto;
private javax.swing.JSeparator jSeparator1;
public static javax.swing.JTextField jTextFieldAutorisation;
public static javax.swing.JTextField jTextFieldNumBadge;
private javax.swing.JToggleButton jToggleButtonPorte;
// End of variables declaration
} |
Partager