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
|
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import javax.swing.filechooser.*;
import java.io.File;
import java.nio.channels.FileChannel;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileOutputStream;
public class Menu extends JMenuBar{
Frame f;
GraphLicence Licen;
String address="";
JMenu file,cdr,aide,media;
JMenuItem fichier, copyfichier,quit,openCD,closCD,info,informationMat,aidehtml,licen;
JMenuItem webca,micro;
Icon open = new ImageIcon("icon/Drive1.png");
Icon closed = new ImageIcon("icon/Drive2.png");
public Menu(){
file = new JMenu("Fichier");
file.setMnemonic(KeyEvent.VK_A);
file.getAccessibleContext().setAccessibleDescription("The only menu in this program that has menu items");
add(file);
fichier = new JMenuItem("Ouvrir fichier vidéo",new ImageIcon("icon/open_gif.gif"));
fichier.setMnemonic('v');
fichier.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
FileFilter avi = new FiltreSimple("Fichiers avi",".avi");
JFileChooser chooser = new JFileChooser(".");
chooser.addChoosableFileFilter(avi);
chooser.setApproveButtonText("Ouvrir");
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)
{
address = chooser.getSelectedFile().getAbsolutePath();
}
}
});
file.add(fichier);
file.add(new JSeparator());
quit = new JMenuItem("Quitter",new ImageIcon("icon/quit_gif.gif"));
quit.setMnemonic('q');
quit.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
System.exit(0);
}
});
file.add(quit);
cdr = new JMenu("Disque");
cdr.setMnemonic(KeyEvent.VK_B);
cdr.getAccessibleContext().setAccessibleDescription("The only menu in this program that has menu items");
openCD = new JMenuItem("Ouvrir lecteur CD/DVD",KeyEvent.VK_T);
openCD.setMnemonic('o');
openCD.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
String drive="";
Device.open (drive);
}
});
cdr.add(openCD);
closCD = new JMenuItem("Fermer lecteur CD/DVD",KeyEvent.VK_T);
closCD.setMnemonic('f');
closCD.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
String drive= "";
Device.close (drive);
}
});
cdr.add(closCD);
add(cdr);
aide = new JMenu("?");
aide.setMnemonic(KeyEvent.VK_C);
aide.getAccessibleContext().setAccessibleDescription("The only menu in this program that has menu items");
add(aide);
licen = new JMenuItem("Licence",new ImageIcon("icon/clee.gif"));
licen.setMnemonic('n');
licen.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
licen = new JMenuItem("Licence",new ImageIcon("icon/clee.gif"));
licen.setMnemonic('n');
licen.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
GraphLicence Licenc = new GraphLicence(this.f,"Saisie numéro de licence",true);
Licenc.setBounds(5,5,450,320);
Licenc.show();
}
});
}
});
aide.add(licen);
aide.add(new JSeparator());
info = new JMenuItem("Information",new ImageIcon("icon/info_gif.gif"));
info.setMnemonic('i');
info.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
Toolkit.getDefaultToolkit().beep();
JOptionPane.showMessageDialog(null,"Logiciel réalisé par\n agon\n Année 2007.","Information",JOptionPane.INFORMATION_MESSAGE);
}
});
aide.add(info);
} |
Partager