tp recursivite
This commit is contained in:
20
DEV3.2/TP02/05_Flocon/Fenetre.java
Normal file
20
DEV3.2/TP02/05_Flocon/Fenetre.java
Normal file
@@ -0,0 +1,20 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Fenetre extends JFrame {
|
||||
|
||||
private int ordre;
|
||||
|
||||
public Fenetre(int ordre) {
|
||||
this.ordre = ordre;
|
||||
|
||||
this.setSize(500, 500);
|
||||
this.setLocation(100, 100);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
this.setLayout(new GridLayout(1, 1));
|
||||
this.add(new JFlocon(ordre));
|
||||
}
|
||||
|
||||
|
||||
}
|
23
DEV3.2/TP02/05_Flocon/JFlocon.java
Normal file
23
DEV3.2/TP02/05_Flocon/JFlocon.java
Normal file
@@ -0,0 +1,23 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class JFlocon extends JComponent {
|
||||
|
||||
private int ordre;
|
||||
|
||||
public JFlocon(int ordre) {
|
||||
this.ordre = ordre;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics pinceau) {
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
|
||||
if (this.isOpaque()) {
|
||||
this.setColor(this.getBackgroundColor());
|
||||
this.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
6
DEV3.2/TP02/05_Flocon/Main.java
Normal file
6
DEV3.2/TP02/05_Flocon/Main.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Fenetre fenetre = new Fenetre(Integer.parseInt(args[0]));
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user