APL/APL2.1/TP6/Acceuil/Accueil.java

48 lines
1.4 KiB
Java
Raw Normal View History

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");
2022-03-28 15:12:08 +02:00
}
@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);
2022-03-28 15:12:08 +02:00
Accueil acc = new Accueil();
2022-03-28 15:12:08 +02:00
JTextField log = new JTextField("");
log.setLocation(140, 140);
log.setSize(100, 25);
2022-03-28 15:12:08 +02:00
JTextField mdp = new JTextField("");
mdp.setLocation(140, 200);
mdp.setSize(100, 25);
2022-03-28 15:12:08 +02:00
fenetre.add(log);
fenetre.add(mdp);
fenetre.add(acc);
2022-03-28 15:12:08 +02:00
fenetre.setVisible(true);
}
2022-03-28 15:12:08 +02:00
}