Lucas la salope
This commit is contained in:
parent
67ab03f916
commit
bd7322937f
BIN
APL2.1/TP5/Métrique/Metrique.class
Normal file
BIN
APL2.1/TP5/Métrique/Metrique.class
Normal file
Binary file not shown.
58
APL2.1/TP5/Métrique/Metrique.java
Normal file
58
APL2.1/TP5/Métrique/Metrique.java
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
BIN
APL2.1/TP5/Métrique/TestMétrique.class
Normal file
BIN
APL2.1/TP5/Métrique/TestMétrique.class
Normal file
Binary file not shown.
43
APL2.1/TP5/Métrique/TestMétrique.java
Normal file
43
APL2.1/TP5/Métrique/TestMétrique.java
Normal 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());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user