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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<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"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
package TP1;
|
|
||||||
|
|
||||||
public class Eponge {
|
|
||||||
|
|
||||||
}
|
|
@ -8,7 +8,28 @@ import javax.swing.JFrame;
|
|||||||
public class FenetreG extends JFrame {
|
public class FenetreG extends JFrame {
|
||||||
static Random generator = new Random() ;
|
static Random generator = new Random() ;
|
||||||
|
|
||||||
|
|
||||||
public void paint(Graphics g) {
|
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) {
|
public static void main(String[] args) {
|
||||||
@ -16,7 +37,6 @@ public class FenetreG extends JFrame {
|
|||||||
fenetre.setDefaultCloseOperation(EXIT_ON_CLOSE) ;
|
fenetre.setDefaultCloseOperation(EXIT_ON_CLOSE) ;
|
||||||
fenetre.setExtendedState(MAXIMIZED_BOTH) ;
|
fenetre.setExtendedState(MAXIMIZED_BOTH) ;
|
||||||
fenetre.setVisible(true) ;
|
fenetre.setVisible(true) ;
|
||||||
fenetre.triGraphique();
|
|
||||||
fenetre.repaint();
|
fenetre.repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user