35 lines
820 B
Java
35 lines
820 B
Java
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());
|
|
|
|
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);
|
|
secondPinceau.fillOval(140,10,25,25);
|
|
|
|
secondPinceau.drawImage(this.img, 180,10, this);
|
|
|
|
}
|
|
}
|
|
|