import javax.swing.*;
import java.awt.print.Paper;

public class Metrique extends Paper {

	public Metrique() {
		super();

		double a4WidthMM = 210.0;
		double a4HeightMM = 297.0;
		double marginMM = 15.0
;
		double a4WidthConverti = convertMM(a4WidthMM);
		double a4HeightConverti = convertMM(a4HeightMM);
		double marginConverti = convertMM(marginMM);

		super.setSize(a4Widthconverti, a4Heightconverti);

		super.setImageableArea(marginConverti, marginConverti, a4Widthconverti - 2 * marginConverti, a4HeightConverti - 2 * marginConverti);
	}

	private double convertToMM(double mm) {
		return mm / 25.4 * 72.0;
	}

	private double convertToUS(double US) {
		return US / 72.0 * 25.4;
	}

	public double getheightMetric(){
		return convertToUS(super.getHeight());
	}

	public double getwidthMetric() {
		return convertToUS(super.getWidth());
	}

	public double getMetricImageableX() {
		return convertToUS(super.getImageableX());
	}

	public double getMetricImageableY() {
		return convertToUS(super.getImageableY());
	}

	public double getMetricImageableWidth() {
		return convertToUS(super.getImageableWidth());
	}

	public double getMetricImageableHeight() {
		return convertToUS(super.getImageableHeihgt());
	}

	public void setsizeMetric(double widthSize, double heightSize) {
		super.setSize(convertToMM(widthSize), convertToMM(heightSize));
	}

	public void setImageableAreaMetric(double xMm, double yMm, double widthMm, double heightMm) {
		super.setImageableArea(convertToUS(xMm),convertToUS(yMm),convertToUS(widthMm),convertToUS(heightMm));
	}

	public static void main(String[] args) {
		Metrique feuille = new Metrique();
		System.out.println(feuille.getheightMetric());
		System.out.println(feuille.getwidthMetric());
        System.out.println(feuille.getMetricImageableX());
        System.out.println(feuille.getMetricImageableY());
        System.out.println(feuille.getImageableWidth());
        System.out.println(feuille.getImageableHeight());
        


		
	}
} 

