TP-programmation-orientee-o.../TP04/ExempleEcran.java
2023-06-20 21:02:09 +02:00

32 lines
854 B
Java

import afficheur.AfficheurSVG;
import afficheur.Ecran;
import java.awt.Color;
/**
* Exemple d'utilisation de la classe Ecran.
*/
class ExempleEcran {
public static void main(String[] args) {
// Construire un écran
// AfficheurTexte monEcran = new AfficheurTexte();
Ecran monEcran = new Ecran("ExempleEcran", 400, 250, 15);
// Dessiner les axes
monEcran.dessinerAxes();
// Dessiner un point vert de coordonnées (1, 2)
monEcran.dessinerPoint(1, 2, Color.GREEN);
// Dessiner un segment rouge d'extrémités (6, 2) et (11, 9)
monEcran.dessinerLigne(6, 2, 11, 9, Color.RED);
// Dessiner un cercle jaune de centre (4, 3) et rayon 2.5
monEcran.dessinerCercle(4, 3, 2.5, Color.YELLOW);
// Dessiner le texte "Premier dessin" en bleu à la position (1, -2)
monEcran.dessinerTexte(1, -2, "Premier dessin", Color.BLUE);
}
}