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
| import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Fenarij implements ActionListener
{
public static void main(String[] args)
{
JFrame fenetre = new JFrame();
JPanel panel = new JPanel();
JLabel welcome = new JLabel("Bienvenue en tunisie Telecom ");
JLabel actel = new JLabel("ACTEL beit elhekma Kairouan");
JLabel gestion = new JLabel("Gestion des publitels ");
fenetre.setContentPane(panel);
fenetre.setTitle("acceuil");
fenetre.getContentPane().setBackground(new Color(255,255,255));
Font font = new Font("Monotype Corsiva",Font.BOLD,20);
welcome.setForeground(new Color(0,51,255));
welcome.setFont(font);
actel.setFont(font);
actel.setForeground(new Color(0,51,255));
Font font1 = new Font("Monotype Corsiva",Font.BOLD,15);
gestion.setFont(font1);
panel.add(welcome);
panel.add(actel);
panel.add(gestion);
JButton a = new JButton("ADMINISTRATEUR");
JLabel b = new JLabel("RESPONSABLE ADMINISTRATIF");
a.setFont(font);
b.setFont(font);
a.setForeground(new Color(0,135,204));
b.setForeground(new Color(0,135,204));
Box ABox1 = Box.createHorizontalBox();
ABox1.add(a);
ABox1.add(Box.createHorizontalStrut(30));
ABox1.add(b);
ImageIcon icone = new ImageIcon("taxi-phone.jpg");
JLabel image = new JLabel(icone);
image.setSize(panel.getWidth(),panel.getHeight());
Box ABox2= Box.createVerticalBox();
ABox2.add(Box.createVerticalStrut(100));
ABox2.add(ABox1);
ABox2.add(Box.createVerticalStrut(100));
ABox2.add(image);
panel.add(ABox2);
panel.repaint();
a.addActionListener(this);
public void actionPerformed(ActionEvent e) {
// Étape 2bis
if(e.getSource() == a) {
new Auth();
fenetre1.dispose();
}
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.setVisible(true);
fenetre.setSize(570,500);
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
fenetre.setLocation(dim.width/2 - fenetre.getWidth()/2, dim.height/2 - fenetre.getHeight()/2);
}
}
class Auth{
public Auth{
// TODO Auto-generated method stub
// création de la fenêtre
JFrame fenetre1 = new JFrame();
fenetre1.setTitle("Authentification");
// ma fenetre doit se fermer quand en clique sue le bouton rouge
fenetre1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JLabel login= new JLabel("login:");
JTextField textlogin = new JTextField(15);
textlogin.setMaximumSize(textlogin.getPreferredSize());
Box ABox1 = Box.createHorizontalBox();
ABox1.add(login);
ABox1.add(Box.createHorizontalStrut(6));
ABox1.add(textlogin);
JLabel mdp = new JLabel ("password :");
JPasswordField textmdp = new JPasswordField(15);
textmdp.setMaximumSize(textmdp.getPreferredSize());
Box ABox2 = Box.createHorizontalBox();
ABox2.add(mdp);
ABox2.add(Box.createHorizontalStrut(6));
ABox2.add(textmdp);
Box ABox3 = Box.createHorizontalBox();
// Box ABox3 = Box.createHorizontalBox();
ABox3.add(new JButton("valider"));
ABox3.add(Box.createGlue());
ABox3.add(new JButton("reinitialiser"));
Box vBox = Box.createVerticalBox();
vBox.add(ABox1);
vBox.add(ABox2);
vBox.add(Box.createGlue());
vBox.add(ABox3);
fenetre1.getContentPane().add(vBox);
fenetre1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre1.setVisible(true);
fenetre1.setSize(500,500);
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
fenetre1.setLocation(dim.width/2 - fenetre1.getWidth()/2, dim.height/2 - fenetre1.getHeight()/2);
}
} |
Partager