33 lines
793 B
Java
33 lines
793 B
Java
|
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));
|
||
|
}
|
||
|
}
|