Erwan Gay
This commit is contained in:
parent
bd7322937f
commit
70c2cf6f54
BIN
APL2.1/TP6/Formes/Formes.class
Normal file
BIN
APL2.1/TP6/Formes/Formes.class
Normal file
Binary file not shown.
16
APL2.1/TP6/Formes/Formes.java
Normal file
16
APL2.1/TP6/Formes/Formes.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
BIN
APL2.1/TP6/Formes/cercles.png
Normal file
BIN
APL2.1/TP6/Formes/cercles.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
APL2.1/TP6/Formes/dessiner.class
Normal file
BIN
APL2.1/TP6/Formes/dessiner.class
Normal file
Binary file not shown.
32
APL2.1/TP6/Formes/dessiner.java
Normal file
32
APL2.1/TP6/Formes/dessiner.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
27
APL2.1/TP6/Sautoir/PaintFormes.java
Normal file
27
APL2.1/TP6/Sautoir/PaintFormes.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
23
APL2.1/TP6/Sautoir/Paintsablier.java
Normal file
23
APL2.1/TP6/Sautoir/Paintsablier.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
APL2.1/TP6/Sautoir/Sablier.java
Normal file
13
APL2.1/TP6/Sautoir/Sablier.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user