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
| package projet2;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class Conteneur_Fenetre_Principale extends JPanel implements ActionListener {
private JLabel Etiquette;
private JButton Tleader;
private JButton Testeur;
private JButton Dev;
private JButton btn;
GridBagConstraints gbc = new GridBagConstraints();
Graphics g ;
////////////////////////////////////////////////////////////////////////////////////////////////////////////
public Conteneur_Fenetre_Principale()
{
super();
setLayout(new GridBagLayout());
//mettre les boutons eloigné les uns des aures
gbc.insets=new Insets(5, 5, 5, 5);
this.prop_Conteneur();
}
//////////////////////////////////////////////////////////////////////////////////////////////////
private void prop_Conteneur() {
this.pro_Etiquette();
this.pro_Bouton();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void paintComponent(Graphics g)
{
try {
Image img = ImageIO.read(new File("img/BG.jpg"));
g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), this);
} catch (IOException e) {
e.printStackTrace();
}
}
private void pro_Etiquette() {
Etiquette = new JLabel("veuillez choisir votre statut");
this.Etiquette.setForeground(Color.black);
Font font = new Font("Arial",Font.BOLD,30);
Etiquette.setFont(font);
gbc.gridx=0;
gbc.gridy=0;
this.add(Etiquette,gbc);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void pro_Bouton() {
Tleader = new JButton("Team Leader");
gbc.gridx=0;
gbc.gridy=1;
Font font1 = new Font("Arial",Font.BOLD,30);
Tleader.setFont(font1);
Tleader.setForeground(Color.black);
CardLayout cl = new CardLayout();
Tleader.addActionListener(this);
TeamLeader t = new TeamLeader();
Tleader.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
//heelpe
// je ne trouve pas le code a mettre ici pour que sa fonctionne
}
});
this.add(Tleader,gbc);
Testeur=new JButton("Testeur");
gbc.gridx=0;
gbc.gridy=2;
Font font2 = new Font("Arial",Font.BOLD,30);
Testeur.setFont(font2);
Testeur.setForeground(Color.black);
gbc.fill=GridBagConstraints.HORIZONTAL;
this.add(Testeur,gbc);
Dev = new JButton("Devloppeur");
gbc.gridx=0;
gbc.gridy=3;
Font font3 = new Font("Arial",Font.BOLD,30);
Dev.setFont(font3);
Dev.setForeground(Color.black);
this.add(Dev,gbc);
}
@Override
public void actionPerformed(ActionEvent e) {
}
} |
Partager