A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
graphlib_java.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add comments to examples.
[graphlib_java.git]
/
Exemple2.java
diff --git
a/Exemple2.java
b/Exemple2.java
index
1cff9d9
..
0043e5b
100644
(file)
--- a/
Exemple2.java
+++ b/
Exemple2.java
@@
-3,10
+3,13
@@
import java.util.*;
public class Exemple2 {
public static void main(String[] args) {
public class Exemple2 {
public static void main(String[] args) {
+ // Création de la fenêtre
DrawingWindow w = new DrawingWindow("Exemple 3", 640, 480);
int width = Math.min(w.width - 1, w.height - 1) / 2;
DrawingWindow w = new DrawingWindow("Exemple 3", 640, 480);
int width = Math.min(w.width - 1, w.height - 1) / 2;
+ // Affichage de rectangles concentriques, avec un dégradé de
+ // couleurs
for (int z = 0; z <= width; z++) {
float r, g, b;
float s = 3.0f * z / width;
for (int z = 0; z <= width; z++) {
float r, g, b;
float s = 3.0f * z / width;
@@
-25,7
+28,9
@@
public class Exemple2 {
g = 0.0f;
b = 1.0f - s;
}
g = 0.0f;
b = 1.0f - s;
}
+ // On change la couleur de dessin...
w.setColor(r, g, b);
w.setColor(r, g, b);
+ // ... et on affiche un rectangle
w.drawRect(z, z, w.width - 1 - z, w.height - 1 - z);
}
}
w.drawRect(z, z, w.width - 1 - z, w.height - 1 - z);
}
}