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

47 lines
1.6 KiB
Java

import afficheur.Afficheur;
public class AfficheurTexte implements Afficheur {
public void dessinerPoint(double x, double y, java.awt.Color c) {
System.out.println("Point {");
System.out.printf(" x = %f\n", x);
System.out.printf(" y = %f\n", y);
System.out.print( " couleur = ");
System.out.println(c);
System.out.println("}");
}
public void dessinerLigne(double x1, double y1, double x2, double y2, java.awt.Color c) {
System.out.println("Ligne {");
System.out.printf(" x1 = %f\n", x1);
System.out.printf(" y1 = %f\n", y1);
System.out.printf(" x2 = %f\n", x2);
System.out.printf(" y2 = %f\n", y2);
System.out.print( " couleur = ");
System.out.println(c);
System.out.println("}");
}
public void dessinerCercle(double x, double y, double rayon, java.awt.Color c) {
System.out.println("Cercle {");
System.out.printf(" centre_x = %f\n", x);
System.out.printf(" centre_y = %f\n", y);
System.out.printf(" rayon = %f\n", rayon);
System.out.print( " couleur = ");
System.out.println(c);
System.out.println("}");
}
public void dessinerTexte(double x, double y, java.lang.String texte, java.awt.Color c) {
System.out.println("Texte {");
System.out.printf(" x = %f\n", x);
System.out.printf(" y = %f\n", y);
System.out.printf(" valeur = %s\n", texte);
System.out.print( " couleur = ");
System.out.println(c);
System.out.println("}");
}
}