update
This commit is contained in:
@@ -13,14 +13,20 @@ public class Gris extends Color {
|
||||
this.rgb2 = y;
|
||||
this.rgb3 = z;
|
||||
|
||||
return x,y,z;
|
||||
System.out.println(x,y,z);
|
||||
}
|
||||
|
||||
public int verifyRGB(int val1, int val2, int val3) {
|
||||
|
||||
public Gris(String valHexa) {
|
||||
valHexa = "#808080";
|
||||
|
||||
System.out.println(valHexa);
|
||||
}
|
||||
l bslslvns
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
Gris colour = new Gris(12,3,4);
|
||||
System.out.println(colour);
|
||||
|
||||
}
|
||||
}
|
76
DEV.2.1/TP/TP5-Heritage/Metrique.java
Normal file
76
DEV.2.1/TP/TP5-Heritage/Metrique.java
Normal file
@@ -0,0 +1,76 @@
|
||||
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());
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user