exo 3 ok
This commit is contained in:
parent
09e43c2301
commit
2b12e4c7eb
12
.classpath
12
.classpath
@ -1,6 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="src" path="tests"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -1,5 +0,0 @@
|
||||
package TP1;
|
||||
|
||||
public class Eponge {
|
||||
|
||||
}
|
@ -3,12 +3,33 @@ package TP1;
|
||||
import java.awt.Graphics;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class FenetreG extends JFrame {
|
||||
static Random generator = new Random() ;
|
||||
|
||||
|
||||
public void paint(Graphics g) {
|
||||
menger(g, 400, 50, (int) Math.pow(3, 6));
|
||||
}
|
||||
|
||||
|
||||
public void menger(Graphics g, int x, int y, int taille) {
|
||||
if (taille <= 1) {
|
||||
g.drawRect(x, y, 1, 1);
|
||||
} else {
|
||||
menger(g, x, y, taille/3);
|
||||
menger(g, x, y + taille/3, taille/3);
|
||||
menger(g, x, y + 2 * taille/3, taille/3);
|
||||
|
||||
menger(g, x + taille/3, y, taille/3);
|
||||
menger(g, x + taille/3, y + 2 * taille/3, taille/3);
|
||||
|
||||
menger(g, x + 2 * taille/3, y, taille/3);
|
||||
menger(g, x + 2 * taille/3, y + taille/3, taille/3);
|
||||
menger(g, x + 2 * taille/3, y + 2 * taille/3, taille/3);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
@ -16,7 +37,6 @@ public class FenetreG extends JFrame {
|
||||
fenetre.setDefaultCloseOperation(EXIT_ON_CLOSE) ;
|
||||
fenetre.setExtendedState(MAXIMIZED_BOTH) ;
|
||||
fenetre.setVisible(true) ;
|
||||
fenetre.triGraphique();
|
||||
fenetre.repaint();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user