TP06 - TP07 début

This commit is contained in:
2022-03-07 17:26:31 +01:00
parent 975abd0e19
commit a5665f3b23
24 changed files with 175 additions and 2 deletions

Binary file not shown.

View File

@@ -0,0 +1,33 @@
import java.awt.print.Paper;
public class MetricPaper extends Paper {
private static double toMetric(double inch) {
return inch * 2.54d;
}
private static double toInch(double metric) {
return metric / 2.54d;
}
public double getMetricHeight() {
return toMetric(this.getHeight());
}
public double getMetricWidth() {
return toMetric(this.getWidth());
}
public double getMetricImageableX() {
return toMetric(this.getImageableX());
}
public double getMetricImageableY() {
return toMetric(this.getImageableY());
}
public MetricPaper() {
super();
this.setSize(toInch(210d), toInch(297d));
this.setImageableArea(toInch(15), toInch(15), toInch(180), toInch(267));
}
}

Binary file not shown.

View File

@@ -0,0 +1,8 @@
import java.awt.print.Paper;
public class MetricTest {
public static void main(String[] args) {
MetricPaper p = new MetricPaper();
System.out.println(p.getMetricHeight());
}
}