48 lines
1.4 KiB
Java
48 lines
1.4 KiB
Java
import java.awt.*;
|
|
import javax.swing.*;
|
|
|
|
public class Accueil extends JComponent
|
|
{
|
|
private Image login;
|
|
public Accueil()
|
|
{
|
|
super();
|
|
this.login = Toolkit.getDefaultToolkit().getImage("/export/home/an21/vieirae/APL/APL2.1/TP6/Acceuil/login.jpg");
|
|
}
|
|
@Override
|
|
protected void paintComponent(Graphics pinceau)
|
|
{
|
|
Graphics secondPinceau = pinceau.create();
|
|
|
|
if (this.isOpaque())
|
|
{
|
|
secondPinceau.setColor(this.getBackground());
|
|
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
|
}
|
|
secondPinceau.drawImage(this.login, 0, 0, this.getWidth(), this.getHeight(), this);
|
|
}
|
|
public static void main(String[] args) {
|
|
JFrame fenetre = new JFrame();
|
|
fenetre.setSize(300, 300);
|
|
fenetre.setLocation(100, 100);
|
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
|
|
Accueil acc = new Accueil();
|
|
|
|
JTextField log = new JTextField("");
|
|
log.setLocation(140, 140);
|
|
log.setSize(100, 25);
|
|
|
|
JTextField mdp = new JTextField("");
|
|
mdp.setLocation(140, 200);
|
|
mdp.setSize(100, 25);
|
|
|
|
|
|
fenetre.add(log);
|
|
fenetre.add(mdp);
|
|
fenetre.add(acc);
|
|
|
|
fenetre.setVisible(true);
|
|
}
|
|
}
|