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
|
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JSlider;
import javax.swing.JWindow;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.event.ChangeEvent;
import LIGHT_X.InterfaceFenetre.BoutonActionListener;
import ModelBoutonTransparent.BoutonTransparent;
import ModelBoutonTransparent.BoutonTransparentParam;
public class Copy_2_of_FenetreParametres extends JFrame implements ActionListener{
private JPanel zoneOption;
private BoutonTransparent btnX = new BoutonTransparent("Mode Administrateur");
private JComboBox<String> backgrounds;
public ImageIcon icon = null;
public Copy_2_of_FenetreParametres() {
////////////////////////// TEST ////////////////////
try {
icon = new ImageIcon(ImageIO.read(new File("background/bg (36)5.jpg")));
} catch (IOException e) {
// pb de chargement de l'image
e.printStackTrace();
}
JLabel contentPane = new JLabel(icon);
// ajoute le conteneur
this.setContentPane(contentPane);
// modification du layout
this.getContentPane().setLayout(new FlowLayout(FlowLayout.LEFT));
// ajout de composants
///////////////////////////////////////////////////
this.setSize(1000, 720);
this.setLocation(110, 250);
this.setVisible(true);
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
initcontroles();
}
private void initcontroles() {
zoneOption = (JPanel) this.getContentPane();
// NE PAS OUBLIER DE METTRE TOUS LES PANNEAUX ET ELEMENT EN "opaque(false)"
zoneOption.setOpaque(false);
JPanel zoneHaut = new JPanel();
JPanel zoneBas = new JPanel();
//----creer un panel contenant toutes les options pour pouvoir inserer un layout null etp ouvoir placer les composant comme on veut
JPanel cadreOpt = new JPanel(null);
cadreOpt.setOpaque(false);
Font ecritureOpt2 = new Font("Arial", Font.BOLD, 18);
Font ecritureOpt = new Font("Arial", Font.BOLD, 25); //Tw Cen MT Condensed
/**================== Changer arriere plan */
JLabel opt1 = new JLabel("Changer d'arrière plan");
opt1.setBounds(90, 40, 350, 30);
opt1.setForeground(Color.white);
opt1.setFont(ecritureOpt);
cadreOpt.add(opt1);
//---Ajouter une combobox
String [] choix = {"Bleu Design", "Lumilux", "Nature", "Beauty", "Abstrait"};
backgrounds = new JComboBox<String> ();
for (int i = 0; i<choix.length; i++) {backgrounds.addItem(choix[i]);} //--- Boucle qui ajoute au combobox les item du tableau donné
backgrounds.setBounds(548, 42, 180, 30);
backgrounds.setBackground(null);
backgrounds.setFont(ecritureOpt2);
backgrounds.setForeground(Color.black);
backgrounds.setOpaque(false);
backgrounds.addActionListener(this);
cadreOpt.add(backgrounds);
/**================== Desactiver voix */
JLabel opt2 = new JLabel("Activer les voix");
opt2.setBounds(90, 90, 350, 30);
opt2.setForeground(Color.white);
opt2.setFont(ecritureOpt);
cadreOpt.add(opt2);
//---Ajouter une checkbox "[] activer)
JCheckBox chkActive = new JCheckBox("Activer"); //--- Cree un CheckBox
chkActive.setSelected(true); //--- Coche la case
chkActive.setBounds(544, 93, 350, 30);
chkActive.setBackground(Color.white);
chkActive.setFont(ecritureOpt2);
chkActive.setForeground(Color.black);
chkActive.setOpaque(false);
cadreOpt.add(chkActive);
/**================== Changer voix */
JLabel opt3 = new JLabel("Choix de la voix");
opt3.setBounds(90, 140, 350, 30);
opt3.setForeground(Color.white);
opt3.setFont(ecritureOpt);
cadreOpt.add(opt3);
//---Ajouter une radiobutton (femme, homme)
JPanel optionVoix = new JPanel();
JRadioButton optH = new JRadioButton("Homme");
JRadioButton optF = new JRadioButton("Femme");
optF.setSelected(true);
optH.setOpaque(false);
optF.setOpaque(false);
optH.setFont(ecritureOpt2);
optF.setFont(ecritureOpt2);
ButtonGroup grpOption = new ButtonGroup();
grpOption.add (optH);
grpOption.add (optF);
optionVoix.add (optH);
optionVoix.add (optF);
optionVoix.setBounds(490, 140, 300, 30);
optionVoix.setOpaque(false);
cadreOpt.add(optionVoix);
/**================== TITRE */
JLabel optTitre = new JLabel("Paramètrage");
optTitre.setOpaque(false);
zoneBas.setOpaque(false);
zoneBas.setLayout(null);
//////////////////////////////////////////////
optTitre.setFont(new Font("Arial", Font.ITALIC+Font.BOLD, 54));
optTitre.setForeground(Color.white);
//optTitre.setForeground(new Color(0, 255, 0, 96));
zoneHaut.setOpaque(false); ///// Ajout du label au panneau nord
zoneHaut.add(optTitre);
/**================== BOUTON ADMIN */
btnX.setOpaque(false);
btnX.setFocusPainted(false);
btnX.setForeground(Color.YELLOW);
btnX.setBounds(40, 560, 200, 30);
btnX.setFont(new Font("Arial", Font.BOLD, 15));
btnX.addActionListener(this);
zoneBas.setOpaque(false);
cadreOpt.add(btnX);
zoneOption.add(zoneHaut, BorderLayout.NORTH);
zoneOption.add(cadreOpt, BorderLayout.CENTER);
zoneOption.add(zoneBas, BorderLayout.SOUTH);
zoneOption.setVisible(true);
getContentPane().add(zoneOption);
//setVisible(true);
}
/**
*
* ACTIONS LISTENER
*
*/
public void actionPerformed(ActionEvent e) {
if (e.getSource() == backgrounds) backgrounds_click(); //-- si on clique sur le panneau combobox pour choisir l'arriere plan
if (e.getSource() == btnX) btn_admin_click();
}
private void btn_admin_click() {
}
private void backgrounds_click() {
//--deja on va chercher a savoir sur kel arriere plan on a cliké
if (backgrounds.getSelectedItem().toString() == "Bleu Design") Bleu_Design_click();//--si tu click sur le bleu alors tu change l'arriere plan de l'interface et l'arriere plan des petites fenetres
if (backgrounds.getSelectedItem().toString() == "Lumilux") Lumilux_click();
// if (backgrounds.getSelectedItem().toString() == "Nature") Nature();
// if (backgrounds.getSelectedItem().toString() == "Beauty") Beauty();
// if (backgrounds.getSelectedItem().toString() == "Abstrait") Abstrait();
}
//--ensuite on va affecter une action differente pour chaque arriere plan
/**========== CHANGER D'ARRIERE PLAN BLEU */
private void Bleu_Design_click() {
}
/**========== CHANGER D'ARRIERE PLAN BLEU */
private void Lumilux_click() {
}
/**
* @param args
*/
public static void main(String[] args) {
Copy_2_of_FenetreParametres fen = new Copy_2_of_FenetreParametres();
fen.setVisible(true);
}
} |
Partager