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
|
import java.applet.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class intro extends Applet implements MouseListener{
private static final long serialVersionUID = 1L; //ID par défaut
final int larg_button = 20;
final int long_button = 100;
final int posX = 300; final int posY = 80;
JButton retou = new JButton("Retour");
JButton ident = new JButton("Identification");
JButton quitt = new JButton("Quitter");
JButton site = new JButton("Site AFPA");
JLabel Tlogin = new JLabel();
JTextField login = new JTextField(8);
JLabel debog = new JLabel("Ligne de deboggage");
JPanel panel1 = new JPanel();JPanel panel2 = new JPanel();
Image fond; //buffer image de fond
Image im; //............ principale
public void paint(Graphics g)
{
g.drawImage(fond,5,5,this); //dessin image de fond
//g.drawImage(im,5,5,this);
}
public void init()
{
super.init();
setSize(1000,1000);
this.setLayout(null); // desactive la gestion d emplacement
setBackground(Color.white);
fond = getImage(getCodeBase(), "fond.JPG");
ident.addMouseListener(this);
site.addMouseListener(this);
retou.addMouseListener(this);
quitt.addMouseListener(this);
ident.setBackground(Color.white);ident.setForeground(Color.blue);
ident.setFont(new Font("TimesRoman", Font.BOLD,12));ident.setName("ident");
site.setBackground(Color.white);site.setForeground(Color.blue);
site.setFont(new Font("TimesRoman", Font.BOLD,12));site.setName("site");
retou.setBackground(Color.white);retou .setForeground(Color.blue);
retou.setFont(new Font("TimesRoman", Font.BOLD,12));retou.setName("retou");
quitt.setBackground(Color.white);quitt.setForeground(Color.blue);
quitt.setFont(new Font("TimesRoman", Font.BOLD,12));quitt.setName("quitt");
Tlogin.setFont(new Font("TimesRoman", Font.BOLD,12));
Tlogin.setText("Login : ");
panel1.add(ident);panel1.add(site);panel1.add(quitt);
panel2.add(Tlogin);panel2.add(login);panel2.add(retou);
panel1.setBounds(30, 170, 200, 300);panel1.setBackground(Color.blue);
panel2.setBounds(30, 170, 250, 50);panel2.setBackground(Color.pink);
panel1.setLayout(new GridLayout(10,5,5,5));
panel2.setLayout(new FlowLayout(FlowLayout.LEFT));
add(panel1);
add(panel2); panel2.setVisible(false);
/***************/
/* DEBBOOOGGGG */
debog.setBounds(20, 400, long_button+600, larg_button); debog.setName("debog");
add(debog);
}
public void mouseClicked(MouseEvent e)
{
Object nom = e.getComponent().getName();
if (nom == "ident")
{
panel1.setVisible(false);panel2.setVisible(true);
}
if(nom == "retou")
{
panel1.setVisible(true);panel2.setVisible(false);
}
if(nom == "Quitt")
{
System.exit(0);
}
}
public void mouseEntered(MouseEvent e)
{
Object nom = e.getComponent().getName();
if(nom == "ident")
{
ident.setFont(new Font("TimesRoman", Font.BOLD,14));
ident.setForeground(Color.orange);// ident.setBorder(arg0)
}
if (nom == "site")
{
site.setFont(new Font("TimesRoman", Font.BOLD,14));
site.setForeground(Color.orange);
}
if (nom == "retou")
{
retou.setFont(new Font("TimesRoman", Font.BOLD,12));
retou.setForeground(Color.orange);
}
else if(nom == "quitt")
{
quitt.setFont(new Font("TimesRoman", Font.BOLD,14));
quitt.setForeground(Color.orange);
}
}
public void mouseExited(MouseEvent e)
{
Object nom = e.getComponent().getName();
if(nom == "ident")
{
ident.setFont(new Font("TimesRoman", Font.BOLD,12));
ident.setForeground(Color.blue);
}
if (nom == "site")
{
site.setFont(new Font("TimesRoman", Font.BOLD,12));
site.setForeground(Color.blue);
}
if (nom == "retou")
{
retou.setFont(new Font("TimesRoman", Font.BOLD,12));
retou.setForeground(Color.blue);
}
else if(nom == "quitt")
{
quitt.setFont(new Font("TimesRoman", Font.BOLD,12));
quitt.setForeground(Color.blue);
}
} |
Partager