DEV_BUT1/DEV2.1/TP06/Exo3/Accueil.java
2023-04-04 14:03:16 +02:00

50 lines
1.5 KiB
Java

import javax.swing.*;
import java.awt.*;
class Preparation extends JComponent{
private Image pingouin;
public Preparation(){
super();
this.pingouin = Toolkit.getDefaultToolkit().getImage("logo.png");
}
@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.setColor(new Color(147,112,219));
secondPinceau.fillRect(0,0,500,500);
secondPinceau.drawImage(this.pingouin, 10, 0,this);
secondPinceau.setColor(Color.WHITE);
secondPinceau.setFont(new Font("default", Font.BOLD,24));
secondPinceau.drawString("login",70 , 160);
secondPinceau.drawString("password",10 , 200);
JTextField zone = new JTextField();
zone.setForeground(Color.BLACK);
zone.setBackground(Color.WHITE);
zone.setBounds(180,140,150,30);
this.add(zone);
JTextField zone2 = new JTextField();
zone2.setForeground(Color.BLACK);
zone2.setBackground(Color.WHITE);
zone2.setBounds(180,175,150,30);
this.add(zone2);
}
}
public class Accueil{
public static void main(String[] args) {
JFrame fenetre = new JFrame("FESSE");
fenetre.setSize(500, 300);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Preparation cadre = new Preparation();
fenetre.add(cadre);
fenetre.setVisible(true);
}
}