Lucas la salope

This commit is contained in:
Vieira Enzo 2022-02-14 10:34:55 +01:00
parent 67ab03f916
commit bd7322937f
4 changed files with 101 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,58 @@
import java.awt.print.Paper;
public class Metrique extends Paper{
public Metrique(){
super();
this.setSize(this.MmTosoixanteDouziemeDeInch(210d), this.MmTosoixanteDouziemeDeInch(297d));
this.setImageableArea(this.MmTosoixanteDouziemeDeInch(15d), this.MmTosoixanteDouziemeDeInch(15d),this.MmTosoixanteDouziemeDeInch(180d), this.MmTosoixanteDouziemeDeInch(267d));
}
private double soixanteDouziemeDeInchtoMm(double soixanteDouziemeDeInch){
return soixanteDouziemeDeInch*0.352778d;
}
private double MmTosoixanteDouziemeDeInch(double mm){
return mm/0.352778d;
}
public double getMetriqueHeight(){
return this.soixanteDouziemeDeInchtoMm(this.getHeight());
}
public double getMetriqueWidth(){
return this.soixanteDouziemeDeInchtoMm(this.getWidth());
}
public double getMetriqueImageableHeight(){
return this.soixanteDouziemeDeInchtoMm(this.getImageableHeight());
}
public double getMetriqueImageableWidth(){
return this.soixanteDouziemeDeInchtoMm(this.getImageableWidth());
}
public double getMetriqueImageableX(){
return this.soixanteDouziemeDeInchtoMm(this.getImageableX());
}
public double getMetriqueImageableY(){
return this.soixanteDouziemeDeInchtoMm(this.getImageableY());
}
public void setMetriqueImageableArea(double x, double y, double width, double height){
this.setImageableArea(this.MmTosoixanteDouziemeDeInch(x), this.MmTosoixanteDouziemeDeInch(y), this.MmTosoixanteDouziemeDeInch(width), this.MmTosoixanteDouziemeDeInch(height));
}
public void setMetriqueSize( double width, double height){
this.setSize(this.MmTosoixanteDouziemeDeInch(width),this.MmTosoixanteDouziemeDeInch(height));
}
}

Binary file not shown.

View File

@ -0,0 +1,43 @@
public class TestMétrique{
public static void main(String[] args){
Metrique feuille = new Metrique();
System.out.println("\n1/72 DE POUCE\n---------------");
System.out.println("Hauteur = "+feuille.getHeight());
System.out.println("Largeur = "+feuille.getWidth());
System.out.println("Hauteur imageable = "+feuille.getImageableHeight());
System.out.println("Largeur imageable = "+feuille.getImageableWidth());
System.out.println("X imageable = "+feuille.getImageableX());
System.out.println("Y imageable = "+feuille.getImageableY());
System.out.println("\nMILLIMETRE\n---------------");
System.out.println("Hauteur = "+feuille.getMetriqueHeight());
System.out.println("Largeur = "+feuille.getMetriqueWidth());
System.out.println("Hauteur imageable = "+feuille.getMetriqueImageableHeight());
System.out.println("Largeur imageable = "+feuille.getMetriqueImageableWidth());
System.out.println("X imageable = "+feuille.getMetriqueImageableX());
System.out.println("Y imageable = "+feuille.getMetriqueImageableY());
feuille.setMetriqueSize(100,100);
feuille.setMetriqueImageableArea(10,10,80,80);
System.out.println("\n1/72 DE POUCE\n---------------");
System.out.println("Hauteur = "+feuille.getHeight());
System.out.println("Largeur = "+feuille.getWidth());
System.out.println("Hauteur imageable = "+feuille.getImageableHeight());
System.out.println("Largeur imageable = "+feuille.getImageableWidth());
System.out.println("X imageable = "+feuille.getImageableX());
System.out.println("Y imageable = "+feuille.getImageableY());
System.out.println("\nMILLIMETRE\n---------------");
System.out.println("Hauteur = "+feuille.getMetriqueHeight());
System.out.println("Largeur = "+feuille.getMetriqueWidth());
System.out.println("Hauteur imageable = "+feuille.getMetriqueImageableHeight());
System.out.println("Largeur imageable = "+feuille.getMetriqueImageableWidth());
System.out.println("X imageable = "+feuille.getMetriqueImageableX());
System.out.println("Y imageable = "+feuille.getMetriqueImageableY());
}
}