Developpement/23DEV1.1/TPS2/TP01/Dessin/Formes/Formes.java

31 lines
861 B
Java
Raw Permalink Normal View History

2024-12-09 11:53:11 +01:00
import javax.swing.JComponent;
import java.awt.*;
public class Formes
{
private Image trucChelou;
public void paintComponent(Graphics g)
{
Graphics secondPinceau = g.create();
if(isOpaque())
{
secondPinceau.setColor(getBackground());
secondPinceau.drawRect(0, 0, getWidth(), getHeight());
}
secondPinceau.setColor(color.BLUE);
fillRect(10, 10, 50, 50);
secondPinceau.setColor(color.GREEN);
drawOval(30,30, 25, 25);
secondPinceau.setColor(color.MAGENTA);
secondPinceau.drawString(">o<",getWidth()/2 - 30, getHeight()/2);
secondPinceau.("cercles.png", );
}
public static void main(String[] args)
{
JFrame frame = new JFrame("Frame");
frame.setSize(400, 400);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}