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
| package pdg;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
/**
* <p>Titre : </p>
* <p>Description : </p>
* <p>Copyright : Copyright (c) 2003</p>
* <p>Société : </p>
* @author non attribuable
* @version 1.0
*/
public class Principale extends JFrame {
JPanel contentPane;
JMenuBar jMenuBar1 = new JMenuBar();
JMenu jMenuFile = new JMenu();
JMenuItem jMenuFileExit = new JMenuItem();
JMenu jMenuHelp = new JMenu();
JMenuItem jMenuHelpAbout = new JMenuItem();
JToolBar jToolBar = new JToolBar();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
ImageIcon image1;
ImageIcon image2;
ImageIcon image3;
XYLayout xYLayout1 = new XYLayout();
BoutonsPanel boutonsPanel = new BoutonsPanel();
TablesPanel tablesPanel = new TablesPanel();
OptionsPanel optionsPanel = new OptionsPanel();
SaisiePanel saisiePanel = new SaisiePanel();
HeaderPanel headerPanel = new HeaderPanel();
RecherchePanel recherchePanel = new RecherchePanel();
FooterPanel footerPanel = new FooterPanel();
//Construire le cadre
public Principale() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Initialiser le composant
private void jbInit() throws Exception {
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screenSize = kit.getScreenSize();
int screenHeight = screenSize.height;
int screenWidth = screenSize.width;
this.setSize(new Dimension(1024,768));
image1 = new ImageIcon(pdg.Principale.class.getResource("openFile.png"));
image2 = new ImageIcon(pdg.Principale.class.getResource("closeFile.png"));
image3 = new ImageIcon(pdg.Principale.class.getResource("help.png"));
optionsPanel.setPrincipale(this);
boutonsPanel.setPrincipale(this);
headerPanel.setPrincipale(this);
footerPanel.setPrincipale(this);
tablesPanel.setPrincipale(this);
saisiePanel.setPrincipale(this);
recherchePanel.setPrincipale(this);
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(xYLayout1);
// this.setSize(new Dimension(400, 300));
this.setTitle("PDG");
jMenuFile.setText("Fichier");
jMenuFileExit.setText("Quitter");
jMenuFileExit.addActionListener(new Principale_jMenuFileExit_ActionAdapter(this));
jMenuHelp.setText("Aide");
jMenuHelpAbout.setText("A propos");
jMenuHelpAbout.addActionListener(new Principale_jMenuHelpAbout_ActionAdapter(this));
jButton1.setIcon(image1);
jButton1.setToolTipText("Ouvrir un fichier");
jButton2.setIcon(image2);
jButton2.setToolTipText("Fermer le fichier");
jButton3.setIcon(image3);
jButton3.setToolTipText("Aide");
xYLayout1.setWidth(1024);
xYLayout1.setHeight(768);
contentPane.setMinimumSize(new Dimension(1024, 768));
jToolBar.add(jButton1);
jToolBar.add(jButton2);
jToolBar.add(jButton3);
jMenuFile.add(jMenuFileExit);
jMenuHelp.add(jMenuHelpAbout);
jMenuBar1.add(jMenuFile);
jMenuBar1.add(jMenuHelp);
this.setJMenuBar(jMenuBar1);
contentPane.add(jToolBar, new XYConstraints(0, 0, 400, -1));
contentPane.add(saisiePanel, new XYConstraints(123, 68, 889, 305));
contentPane.add(optionsPanel, new XYConstraints(11, 197, 109, 175));
contentPane.add(recherchePanel, new XYConstraints(11, 375, 1002, 30));
contentPane.add(tablesPanel, new XYConstraints(12, 405, 1002, 279));
contentPane.add(footerPanel, new XYConstraints(11, 686, 1002, 30));
contentPane.add(headerPanel, new XYConstraints(123, 37, 889, 29));
contentPane.add(boutonsPanel, new XYConstraints(11, 37, 108, 156));
}
//Opération Fichier | Quitter effectuée
public void jMenuFileExit_actionPerformed(ActionEvent e) {
System.exit(0);
}
//Opération Aide | A propos effectuée
public void jMenuHelpAbout_actionPerformed(ActionEvent e) {
Principale_AboutBox dlg = new Principale_AboutBox(this);
Dimension dlgSize = dlg.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
dlg.setModal(true);
dlg.pack();
dlg.show();
}
//Supplanté, ainsi nous pouvons sortir quand la fenêtre est fermée
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
jMenuFileExit_actionPerformed(null);
}
}
}
class Principale_jMenuFileExit_ActionAdapter implements ActionListener {
Principale adaptee;
Principale_jMenuFileExit_ActionAdapter(Principale adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuFileExit_actionPerformed(e);
}
}
class Principale_jMenuHelpAbout_ActionAdapter implements ActionListener {
Principale adaptee;
Principale_jMenuHelpAbout_ActionAdapter(Principale adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuHelpAbout_actionPerformed(e);
}
} |
Partager