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
| package ab_informatique;
import AB_Informatique.apropo;
import java.awt.Color;
import java.awt.Container;
import java.awt.Desktop;
import java.awt.Rectangle;
import java.awt.event.*;
import java.io.File;
import java.io.IOException;
import java.util.logging.*;
import javax.swing.*;
import javax.swing.JFrame;
class AB_Info extends JFrame implements ActionListener {
JFrame f ;
public static JPanel pan,pan2;
public static JMenuItem Fermer,Fiche,Vente,Identification,Aide,apropo,Diagnostic,Emprent;
public JMenuBar barreMenu ;
public static JMenu Application,Services,Materiel,Help;
String tabs[] = {"Ordinateur Portable", "Ordinateur Fixe", "Ecran", "Impremante"};
JButton modifier ;
public AB_Info () {try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
setSize(860, 617) ;
pan = new Panneau();
getContentPane().add(pan) ;
/* Creation d'une barre de Menu*/
pan.add(barreMenu = new JMenuBar());
setJMenuBar(barreMenu);
/*-------------------------------------------creation de Menu Fichier---------------------------------------*/
Application = new JMenu ("Application");
barreMenu.add(Application);
Application.setIcon(new ImageIcon(new java.net.URL("file:///C:/Documents and Settings/Administrateur/Mes documents/NetBeansProjects/AB_Informatique/Image/window_dialog.png")));
Identification = new JMenuItem("Identifiez");
Identification.setToolTipText("Identification");
Application.add(Identification);
Identification.addActionListener(this);
Identification.setIcon(new ImageIcon(new java.net.URL("file:///C:/Documents and Settings/Administrateur/Mes documents/NetBeansProjects/AB_Informatique/Image/Identification.jpg")));
Fermer = new JMenuItem("Fermer");
Fermer.setToolTipText("exit");
Application.add(Fermer);
Fermer.addActionListener(new EcouteurFermer());
Fermer.setIcon(new ImageIcon(new java.net.URL("file:///C:/Documents and Settings/Administrateur/Mes documents/NetBeansProjects/AB_Informatique/Image/quitter.jpg")));
/*-------------------------------------------creation de Menu Materiel----------------------------------------*/
Materiel = new JMenu ("Materiel");
barreMenu.add(Materiel);
Materiel.setIcon(new ImageIcon(new java.net.URL("file:///C:/Documents and Settings/Administrateur/Mes documents/NetBeansProjects/AB_Informatique/Image/Materiel.jpg")));
Vente=new JMenuItem("Vente");
Materiel.add(Vente);
Vente.setToolTipText("Fiche de Vente");
Vente.addActionListener(this);
Vente.setIcon(new ImageIcon(new java.net.URL("file:///C:/Documents and Settings/Administrateur/Mes documents/NetBeansProjects/AB_Informatique/Image/vente.jpg")));
Fiche = new JMenuItem(" Fiche de Materiel");
Fiche.setToolTipText("Fiche de Materiel");
Materiel.add(Fiche);
Fiche.addActionListener(this);
Fiche.setIcon(new ImageIcon(new java.net.URL("file:///C:/Documents and Settings/Administrateur/Mes documents/NetBeansProjects/AB_Informatique/Image/fiche.jpg")));
/*---------------------------------------creation de Menu Services-----------------------------------------*/
Services = new JMenu ("Services");
barreMenu.add(Services);
Services.setIcon(new ImageIcon(new java.net.URL("file:///C:/Documents and Settings/Administrateur/Mes documents/NetBeansProjects/AB_Informatique/Image/service.jpg")));
Diagnostic = new JMenuItem(" Diagnostic");
Diagnostic.setToolTipText("Diagnostic");
Services.add(Diagnostic);
Diagnostic.addActionListener(this);
Diagnostic.setIcon(new ImageIcon(new java.net.URL("file:///C:/Documents and Settings/Administrateur/Mes documents/NetBeansProjects/AB_Informatique/Image/diagnostic.jpg")));
Emprent = new JMenuItem(" Emprent");
Emprent.setToolTipText("Emprent");
Services.add(Emprent);
Emprent.addActionListener(this);
Emprent.setIcon(new ImageIcon(new java.net.URL("file:///C:/Documents and Settings/Administrateur/Mes documents/NetBeansProjects/AB_Informatique/Image/main.jpg")));
/*-------------------------------------------------Menu Aide-----------------------------------------------*/
Help = new JMenu ("Help");
barreMenu.add(Help);
Help.setIcon(new ImageIcon(new java.net.URL("file:///C:/Documents and Settings/Administrateur/Mes documents/NetBeansProjects/AB_Informatique/Image/sosheowe.gif")));
apropo = new JMenuItem("A Propos");
Help.add(apropo);
apropo.addActionListener(this);
apropo.setIcon(new ImageIcon(new java.net.URL("file:///C:/Documents and Settings/Administrateur/Mes documents/NetBeansProjects/AB_Informatique/Image/about.png")));
Aide = new JMenuItem("Guide de l'Aide");
Help.add(Aide);
Aide.addActionListener(this);
Aide.setIcon(new ImageIcon(new java.net.URL("file:///C:/Documents and Settings/Administrateur/Mes documents/NetBeansProjects/AB_Informatique/Image/help.jpg")));
Help.setEnabled(false);
Services.setEnabled(false);
Materiel.setEnabled(false);
/*----------------------------------------------------------------------------------------------------------*/
}
public void actionPerformed(ActionEvent e) {
if(e.getSource ()== Identification){
SwingUtilities.invokeLater(new Runnable() {
public void run() {
//Turn off metal's use of bold fonts
UIManager.put("swing.boldMetal", Boolean.FALSE);
createAndShowGUI();
}
private void createAndShowGUI() {
JFrame frame = new JFrame("Identification");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
final PasswordDemo newContentPane = new PasswordDemo(frame);
newContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(newContentPane);
//Make sure the focus goes to the right component
//whenever the frame is initially given the focus.
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowActivated(WindowEvent e) {
newContentPane.resetFocus();
}
});
//Display the window.
frame.pack();
frame.setVisible(true);
frame.setLocation(500,300);
}
});
}
if (e.getSource()==Vente){
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Ajouter().setVisible(true);
}
});
}
if(e.getSource()==Diagnostic){
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Pann().setVisible(true);
}
});
}
if (e.getSource()==Fiche){
show.main(tabs);
}
if (e.getSource()==apropo) {
apropo a = new apropo ();
a.setVisible(true);
}
if (e.getSource()==Emprent){
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Emprente().setVisible(true);
}
});
}
if (e.getSource()==Aide){
// On vérifie que la classe Desktop soit bien supportée :
if ( Desktop.isDesktopSupported() ) {
// On récupère l'instance du desktop :
Desktop desktop = Desktop.getDesktop();
// On vérifie que la fonction open est bien supportée :
if (desktop.isSupported(Desktop.Action.OPEN)) {
try {
// Et on lance l'application associé au fichier pour l'ouvrir :
desktop.open(new File("C:\\Users\\SEGNI\\Documents\\Downloads\\Photoshop CS4 Read Me.pdf"));
} catch (IOException ex) {
Logger.getLogger(AB_Info.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
}}
class EcouteurFermer implements ActionListener {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
}
public class IHM {
public static void main(String[] args) {
AB_Info f = new AB_Info ();
f.setVisible(true);
f.setLocation(253,74);
}
} |
Partager