APL/APL2.1/TP5/Métrique/Metrique.java

58 lines
1.6 KiB
Java
Raw Normal View History

2022-02-14 10:34:55 +01:00
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));
}
}