TP06 - TP07 début
This commit is contained in:
BIN
APL2.1/TP06/Metrique/MetricPaper.class
Normal file
BIN
APL2.1/TP06/Metrique/MetricPaper.class
Normal file
Binary file not shown.
33
APL2.1/TP06/Metrique/MetricPaper.java
Normal file
33
APL2.1/TP06/Metrique/MetricPaper.java
Normal 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));
|
||||
}
|
||||
}
|
||||
BIN
APL2.1/TP06/Metrique/MetricTest.class
Normal file
BIN
APL2.1/TP06/Metrique/MetricTest.class
Normal file
Binary file not shown.
8
APL2.1/TP06/Metrique/MetricTest.java
Normal file
8
APL2.1/TP06/Metrique/MetricTest.java
Normal 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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user