52 lines
1.4 KiB
Java
52 lines
1.4 KiB
Java
|
import javax.swing.*;
|
||
|
import java.awt.*;
|
||
|
|
||
|
public class Accueil extends JComponent{
|
||
|
|
||
|
private Image logScreen;
|
||
|
|
||
|
public Accueil(){
|
||
|
super();
|
||
|
this.logScreen = Toolkit.getDefaultToolkit().getImage("logScreen.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.logScreen,0,0, this);
|
||
|
}
|
||
|
|
||
|
public static void main(String[] args){
|
||
|
|
||
|
|
||
|
JFrame fenetre = new JFrame();
|
||
|
|
||
|
fenetre.setSize(295, 223);
|
||
|
fenetre.setMinimumSize(new Dimension(295, 223));
|
||
|
fenetre.setLocation(100, 100);
|
||
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||
|
fenetre.setLayout(null);
|
||
|
|
||
|
|
||
|
Accueil login = new Accueil();
|
||
|
login.setLocation(0,0);
|
||
|
login.setSize(278,183);
|
||
|
fenetre.add(login);
|
||
|
|
||
|
JTextField loginArea = new JTextField();
|
||
|
loginArea.setLocation(110, 90);
|
||
|
loginArea.setSize(150, 25);
|
||
|
fenetre.add(loginArea);
|
||
|
|
||
|
JTextField passwordArea = new JTextField();
|
||
|
passwordArea.setLocation(110, 130);
|
||
|
passwordArea.setSize(150, 25);
|
||
|
fenetre.add(passwordArea);
|
||
|
|
||
|
fenetre.setVisible(true);
|
||
|
}
|
||
|
}
|