APL/APL2.1/TP07/Accueil/LoginScreen.java

22 lines
581 B
Java
Raw Normal View History

2022-03-08 17:15:30 +01:00
import javax.swing.*;
import java.awt.*;
public class LoginScreen extends JComponent {
private Image login;
public LoginScreen() {
super();
this.login = Toolkit.getDefaultToolkit().getImage("login.jpg");
}
@Override
protected void paintComponent(Graphics brush) {
Graphics newBrush = brush.create();
if (this.isOpaque()) {
newBrush.setColor(this.getBackground());
newBrush.fillRect(0, 0, this.getWidth(), this.getHeight());
}
newBrush.drawImage(this.login, 0, 0, this);
}
}