2025-02-11 14:05:42 +01:00
|
|
|
import javax.swing.*;
|
|
|
|
import java.awt.*;
|
|
|
|
|
|
|
|
public class Formes extends JComponent {
|
|
|
|
private Image img;
|
|
|
|
|
|
|
|
public Formes() {
|
|
|
|
super();
|
|
|
|
this.img = Toolkit.getDefaultToolkit().getImage("img.png");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void paintComponent(Graphics pinceau) {
|
|
|
|
|
|
|
|
Graphics secondPinceau = pinceau.create();
|
|
|
|
secondPinceau.setColor(this.getForeground());
|
|
|
|
|
2025-02-11 14:46:08 +01:00
|
|
|
Font fonte = new Font("TimesRoman", Font.BOLD,24);
|
|
|
|
secondPinceau.setColor(new Color(128,0,128));
|
|
|
|
secondPinceau.setFont(fonte);
|
|
|
|
secondPinceau.drawString(">o<", 10, 20);
|
|
|
|
|
|
|
|
secondPinceau.setColor(Color.BLUE);
|
|
|
|
secondPinceau.drawRect(70,10,50,50);
|
|
|
|
|
|
|
|
secondPinceau.setColor(Color.GREEN);
|
|
|
|
secondPinceau.drawOval(140,10,25,25);
|
2025-02-11 14:59:41 +01:00
|
|
|
secondPinceau.fillOval(140,10,25,25);
|
|
|
|
|
|
|
|
secondPinceau.drawImage(this.img, 180,10, this);
|
2025-02-11 14:46:08 +01:00
|
|
|
|
2025-02-13 15:30:47 +01:00
|
|
|
secondPinceau.drawLine(0,0,90,100);
|
|
|
|
secondPinceau.drawLine(100,0,90,100);
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-11 14:46:08 +01:00
|
|
|
}
|
2025-02-11 14:59:41 +01:00
|
|
|
}
|
|
|
|
|