Erwan Gay

This commit is contained in:
Vieira Enzo 2022-02-14 11:02:04 +01:00
parent bd7322937f
commit 70c2cf6f54
8 changed files with 111 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,16 @@
import javax.swing.*;
import java.awt.*;
public class Formes {
public static void main(String[] args) {
JFrame fenetre = new JFrame();
fenetre.setSize(500, 500);
fenetre.setLocation(100, 100);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
dessiner draw = new dessiner();
fenetre.add(draw, BorderLayout.CENTER);
fenetre.setVisible(true);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

View File

@ -0,0 +1,32 @@
import javax.swing.*;
import java.awt.*;
public class dessiner extends JComponent {
private Image image;
public dessiner() {
super();
this.image = Toolkit.getDefaultToolkit().getImage("cercles.png");
}
@Override
protected void paintComponent(Graphics pinceau) {
Graphics secondPinceau = pinceau.create();
if (this.isOpaque()) {
// on change couleur de fond
secondPinceau.setColor(this.getBackground());
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
}
// rectangle zebi
secondPinceau.setColor(Color.BLUE);
secondPinceau.drawRect(5, 5, 55, 55);
// Bleu
secondPinceau.setColor(Color.GREEN);
secondPinceau.fillOval(75, 5, 50, 50);
// Vert
secondPinceau.setColor(new Color(150, 131, 236));
Font fonte = new Font("Gras", Font.BOLD, 24);
secondPinceau.setFont(fonte);
secondPinceau.drawString(">o<", 130, 30);
secondPinceau.drawImage(this.image, 200, 10, this);
}
}

View File

@ -0,0 +1,27 @@
import javax.swing.*;
import java.awt.*;
public class Paintformes extends JComponent {
private Image image;
public Paintformes() {
super();
this.image = Toolkit.getDefaultToolkit().getImage("image.png");
}
@Override
protected void paintComponent(Graphics pinceau) {
Graphics secondPinceau = pinceau.create();
if (this.isOpaque()) {
secondPinceau.setColor(this.getBackground());
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
}
secondPinceau.setColor(Color.BLUE);
secondPinceau.fillRect(5, 5, 55, 55);
secondPinceau.setColor(Color.GREEN);
secondPinceau.fillOval(75, 5, 50, 50);
secondPinceau.setColor(new Color(150, 131, 236));
Font fonte = new Font("Gras", Font.BOLD, 24);
secondPinceau.setFont(fonte);
secondPinceau.drawString(">o<", 130, 30);
secondPinceau.drawImage(this.image, 200, 10, this);
}
}

View File

@ -0,0 +1,23 @@
import javax.swing.*;
import java.awt.*;
public class Paintsablier extends JComponent {
private Image image;
public Paintsablier() {
super();
}
@Override
protected void paintComponent(Graphics pinceau) {
Graphics secondPinceau = pinceau.create();
if (this.isOpaque()) {
secondPinceau.setColor(this.getBackground());
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
}
secondPinceau.setColor(Color.CYAN);
for (int i=0; i<(this.getWidth()/50); i++) {
for (int j=0; j<(this.getHeight()/50); j++) {
secondPinceau.fillPolygon(new int[] {25+i*50,50+i*50,25+i*50,0+i*50},new int[] {-25+j*50,0+j*50,25+j*50,0+j*50},4);
}
}
}
}

View File

@ -0,0 +1,13 @@
import javax.swing.*;
import java.awt.*;
public class Sablier {
public static void main(String[] args) {
JFrame fenetre = new JFrame();
fenetre.setSize(500, 500);
fenetre.setLocation(100, 100);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Paintsablier draw = new Paintsablier();
fenetre.add(draw, BorderLayout.CENTER);
fenetre.setVisible(true);
}
}