This commit is contained in:
Simoes Lukas
2025-03-27 13:35:54 +01:00
parent 376861b608
commit fe693705bf
90 changed files with 1188 additions and 24 deletions

39
DEV2.1/TDs/Main.java Normal file
View File

@@ -0,0 +1,39 @@
import java.awt.*;
import javax.swing.*;
class Img extends JComponent {
private Image img;
public Img() {
// Chargement de l'image
img = Toolkit.getDefaultToolkit().getImage("triangles-1430105_1280.png");
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (img != null) {
g.drawImage(img, 0, 0, this);
}
}
}
class Fenetre extends JFrame {
public Fenetre() {
this.setLocation(100, 100);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Img imagePanel = new Img();
this.add(imagePanel);
this.pack(); // Ajuste la fenêtre à la taille du contenu
}
}
public class Main {
public static void main(String[] args) {
Fenetre fenetre = new Fenetre();
fenetre.setVisible(true);
}
}