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
| import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.*;
public class Fenetre extends JFrame{
/**
*
*/
private static final long serialVersionUID = 1L;
public JPanel panAccueil = new JPanel();
public JPanel panInstal = new JPanel();
public JPanel panPreferences = new JPanel();
public JPanel panConfig = new JPanel();
public JButton installation = new JButton("Installation");
public JButton preferences = new JButton("Préférences");
public JButton configuration = new JButton("Configuration");
public JButton precedentInstal = new JButton("Précédent");
public JButton precedentPref = new JButton("Précédent");
public JButton precedentConf = new JButton("Précédent");
public JLabel enteteAccueil = new JLabel("Entete ici");
public JLabel enteteInstal = new JLabel("Entete Installation");
public JLabel entetePref = new JLabel("Entete Préférences");
public JLabel enteteConf = new JLabel("Entete Configuration");
public JLabel texteInstallation = new JLabel("Installation de votre logiciel");
public JLabel textePref = new JLabel("Choisissez vos préférences");
public JLabel texteConfig = new JLabel("Configurer votre logiciel");
// public JLabel imageInst = new JLabel(new ImageIcon("C:\\Users\\Pierre\\workspace\\Menu\\Installation.jpg"));
// public JLabel imagePref = new JLabel(new ImageIcon("C:\\Users\\Pierre\\workspace\\Menu\\Préférences.jpg"));
// public JLabel imageConf = new JLabel(new ImageIcon("C:\\Users\\Pierre\\workspace\\Menu\\Installation.png"));
public Fenetre(){
init_param_fenetre();
setLayout(null);
panAccueil.setBackground(Color.WHITE);
panInstal.setBackground(Color.WHITE);
panPreferences.setBackground(Color.WHITE);
panConfig.setBackground(Color.WHITE);
panAccueil.add(installation);
panAccueil.add(preferences);
panAccueil.add(configuration);
panAccueil.add(enteteAccueil);
panAccueil.add(texteInstallation);
panAccueil.add(textePref);
panAccueil.add(texteConfig);
// panAccueil.add(imageInst);
// panAccueil.add(imagePref);
// panAccueil.add(imageConf);
panInstal.add(precedentInstal);
panInstal.add(enteteInstal);
panPreferences.add(precedentPref);
panPreferences.add(entetePref);
panConfig.add(precedentConf);
panConfig.add(enteteConf);
installation.setBounds(100, 100, 150, 40);
preferences.setBounds(100, 180, 150, 40);
configuration.setBounds(100, 260, 150, 40);
/*ligne75*/ precedentInstal.setBounds(10, 270, 150, 40);
/*ligne76*/ precedentConf.setBounds(10, 270, 150, 40);
/*ligne77*/ precedentPref.setBounds(10, 270, 150, 40);
enteteAccueil.setBounds(250, 10, 100, 10);
enteteInstal.setBounds(250, 10, 200, 10);
entetePref.setBounds(250, 10, 200, 10);
texteInstallation.setBounds(270, 100, 200, 40);
textePref.setBounds(270, 180, 200, 40);
texteConfig.setBounds(270, 260, 200, 40);
// imageInst.setBounds(10, 90, 63, 65);
// imagePref.setBounds(10, 165, 63, 63);
// imageConf.setBounds(10, 250, 61, 60);
installation.addActionListener(new BlistenInstal(this));
preferences.addActionListener(new BlistenPref(this));
configuration.addActionListener(new BlistenConf(this));
precedentInstal.addActionListener(new BlistenPrecedentInst(this));
precedentPref.addActionListener(new BlistenPrecedentPref(this));
precedentConf.addActionListener(new BlistenPrecedentConf(this));
this.setVisible(true);
}
void init_param_fenetre(){
this.setTitle("Configuration");
this.setSize(600, 400);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLocationRelativeTo(null);
this.setResizable(false);
/*ligne105*/ this.setContentPane(panAccueil);
}
//Boutons du JPanel d'accueil
public class BlistenInstal implements ActionListener{
Fenetre fen;
public BlistenInstal(Fenetre fen){
this.fen = fen;
}
public void actionPerformed(final ActionEvent arg0){
fen.setContentPane(panInstal);
fen.validate();
}
}
public class BlistenPref implements ActionListener{
Fenetre fen;
public BlistenPref(Fenetre fen){
this.fen = fen;
}
public void actionPerformed(final ActionEvent arg0){
fen.setContentPane(panPreferences);
fen.validate();
}
}
public class BlistenConf implements ActionListener{
Fenetre fen;
public BlistenConf(Fenetre fen){
this.fen = fen;
}
public void actionPerformed(final ActionEvent arg0){
fen.setContentPane(panConfig);
fen.validate();
}
}
//Boutons "précédent" pour chaque JPanel choisi
public class BlistenPrecedentInst implements ActionListener{
Fenetre fen;
public BlistenPrecedentInst(Fenetre fen){
this.fen = fen;
}
public void actionPerformed(final ActionEvent arg0){
fen.setContentPane(panAccueil);
fen.validate();
}
}
public class BlistenPrecedentPref implements ActionListener{
Fenetre fen;
public BlistenPrecedentPref(Fenetre fen){
this.fen = fen;
}
public void actionPerformed(final ActionEvent arg0){
fen.setContentPane(panAccueil);
fen.validate();
}
}
public class BlistenPrecedentConf implements ActionListener{
Fenetre fen;
public BlistenPrecedentConf(Fenetre fen){
this.fen = fen;
}
public void actionPerformed(final ActionEvent arg0){
fen.setContentPane(panAccueil);
fen.validate();
}
}
} |
Partager