diff --git a/APL2.1/TP6/Formes/Formes.class b/APL2.1/TP6/Formes/Formes.class new file mode 100644 index 0000000..7a8f9ca Binary files /dev/null and b/APL2.1/TP6/Formes/Formes.class differ diff --git a/APL2.1/TP6/Formes/Formes.java b/APL2.1/TP6/Formes/Formes.java new file mode 100644 index 0000000..aa054a6 --- /dev/null +++ b/APL2.1/TP6/Formes/Formes.java @@ -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); + } +} \ No newline at end of file diff --git a/APL2.1/TP6/Formes/cercles.png b/APL2.1/TP6/Formes/cercles.png new file mode 100644 index 0000000..4713bcc Binary files /dev/null and b/APL2.1/TP6/Formes/cercles.png differ diff --git a/APL2.1/TP6/Formes/dessiner.class b/APL2.1/TP6/Formes/dessiner.class new file mode 100644 index 0000000..49ae739 Binary files /dev/null and b/APL2.1/TP6/Formes/dessiner.class differ diff --git a/APL2.1/TP6/Formes/dessiner.java b/APL2.1/TP6/Formes/dessiner.java new file mode 100644 index 0000000..3f4ef0a --- /dev/null +++ b/APL2.1/TP6/Formes/dessiner.java @@ -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); + } +} \ No newline at end of file diff --git a/APL2.1/TP6/Sautoir/PaintFormes.java b/APL2.1/TP6/Sautoir/PaintFormes.java new file mode 100644 index 0000000..6e9d4dc --- /dev/null +++ b/APL2.1/TP6/Sautoir/PaintFormes.java @@ -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); + } +} \ No newline at end of file diff --git a/APL2.1/TP6/Sautoir/Paintsablier.java b/APL2.1/TP6/Sautoir/Paintsablier.java new file mode 100644 index 0000000..b5b3c17 --- /dev/null +++ b/APL2.1/TP6/Sautoir/Paintsablier.java @@ -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); + } + } + } +} \ No newline at end of file diff --git a/APL2.1/TP6/Sautoir/Sablier.java b/APL2.1/TP6/Sautoir/Sablier.java new file mode 100644 index 0000000..51682d3 --- /dev/null +++ b/APL2.1/TP6/Sautoir/Sablier.java @@ -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); + } +} \ No newline at end of file