diff --git a/APL2.1/TP04/Segment/Segment.class b/APL2.1/TP04/Segment/Segment.class index 2af77ee..4b76ea6 100644 Binary files a/APL2.1/TP04/Segment/Segment.class and b/APL2.1/TP04/Segment/Segment.class differ diff --git a/APL2.1/TP04/Segment/Segment.java b/APL2.1/TP04/Segment/Segment.java index 75450e4..5733de5 100644 --- a/APL2.1/TP04/Segment/Segment.java +++ b/APL2.1/TP04/Segment/Segment.java @@ -37,6 +37,6 @@ public class Segment { } public boolean equals(Segment s2) { - return this.start == s2.start && this.end == s2.end; + return (this.start.equals(s2.start) && this.end.equals(s2.end)); } } \ No newline at end of file diff --git a/APL2.1/TP04/Segment/TestSegment.java b/APL2.1/TP04/Segment/TestSegment.java index 41fb3ea..4d60dcb 100644 --- a/APL2.1/TP04/Segment/TestSegment.java +++ b/APL2.1/TP04/Segment/TestSegment.java @@ -3,6 +3,6 @@ public class TestSegment { Segment s = new Segment(0, 10, 10, 0); Segment s2 = new Segment(0, 10, 10, 0); - System.out.println(s.equals(s2)); + } } \ No newline at end of file diff --git a/APL2.1/TP06/Documentation/Documentation.class b/APL2.1/TP06/Documentation/Documentation.class new file mode 100644 index 0000000..12b0a4e Binary files /dev/null and b/APL2.1/TP06/Documentation/Documentation.class differ diff --git a/APL2.1/TP06/Documentation/Documentation.java b/APL2.1/TP06/Documentation/Documentation.java new file mode 100644 index 0000000..8e61b83 --- /dev/null +++ b/APL2.1/TP06/Documentation/Documentation.java @@ -0,0 +1,9 @@ +public class Documentation { + public static void main(String[] args) { + for (String str : args) { + System.out.println(str.toUpperCase()); + } + + + } +} \ No newline at end of file diff --git a/APL2.1/TP06/Documentation/ToBase8.class b/APL2.1/TP06/Documentation/ToBase8.class new file mode 100644 index 0000000..5446ef6 Binary files /dev/null and b/APL2.1/TP06/Documentation/ToBase8.class differ diff --git a/APL2.1/TP06/Documentation/ToBase8.java b/APL2.1/TP06/Documentation/ToBase8.java new file mode 100644 index 0000000..8d88e75 --- /dev/null +++ b/APL2.1/TP06/Documentation/ToBase8.java @@ -0,0 +1,8 @@ +public class ToBase8 { + public static void main(String[] args) { + for (String str : args) { + int nb = Integer.parseInt(str, 8); + System.out.println(Integer.toHexString(nb).toUpperCase()); + } + } +} \ No newline at end of file diff --git a/APL2.1/TP06/Documentation/reponses.txt b/APL2.1/TP06/Documentation/reponses.txt new file mode 100644 index 0000000..be672fe --- /dev/null +++ b/APL2.1/TP06/Documentation/reponses.txt @@ -0,0 +1,4 @@ +1. java.lang.Object +2. La classe Object +3. 10 (8 dont 2 surcharges) +4. 0 ? \ No newline at end of file diff --git a/APL2.1/TP06/Gris/Gris.class b/APL2.1/TP06/Gris/Gris.class new file mode 100644 index 0000000..fa2a1ad Binary files /dev/null and b/APL2.1/TP06/Gris/Gris.class differ diff --git a/APL2.1/TP06/Gris/Gris.java b/APL2.1/TP06/Gris/Gris.java new file mode 100644 index 0000000..371408f --- /dev/null +++ b/APL2.1/TP06/Gris/Gris.java @@ -0,0 +1,7 @@ +import java.awt.Color; + +public class Gris extends Color { + public Gris(int l) { + super(l, l, l); + } +} \ No newline at end of file diff --git a/APL2.1/TP06/Gris/TestGris.class b/APL2.1/TP06/Gris/TestGris.class new file mode 100644 index 0000000..a404698 Binary files /dev/null and b/APL2.1/TP06/Gris/TestGris.class differ diff --git a/APL2.1/TP06/Gris/TestGris.java b/APL2.1/TP06/Gris/TestGris.java new file mode 100644 index 0000000..74da792 --- /dev/null +++ b/APL2.1/TP06/Gris/TestGris.java @@ -0,0 +1,24 @@ +import javax.swing.*; +import java.awt.*; + +public class TestGris { + public static void main(String[] args) { + int size = Integer.parseInt(args[0]); + + JFrame fenetre = new JFrame("Damier"); + fenetre.setSize(size * 50, size * 50); + fenetre.setLocation(100, 100); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + GridLayout grid = new GridLayout(size, size); + fenetre.setLayout(grid); + + for (int i = 0; i < size * size; i++) { + JPanel panel = new JPanel(); + if (i % 2 == 0) panel.setBackground(new Gris(150)); + else panel.setBackground(Color.WHITE); + fenetre.add(panel); + } + + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/APL2.1/TP06/Metrique/MetricPaper.class b/APL2.1/TP06/Metrique/MetricPaper.class new file mode 100644 index 0000000..b769fe2 Binary files /dev/null and b/APL2.1/TP06/Metrique/MetricPaper.class differ diff --git a/APL2.1/TP06/Metrique/MetricPaper.java b/APL2.1/TP06/Metrique/MetricPaper.java new file mode 100644 index 0000000..95ff617 --- /dev/null +++ b/APL2.1/TP06/Metrique/MetricPaper.java @@ -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)); + } +} \ No newline at end of file diff --git a/APL2.1/TP06/Metrique/MetricTest.class b/APL2.1/TP06/Metrique/MetricTest.class new file mode 100644 index 0000000..b08e459 Binary files /dev/null and b/APL2.1/TP06/Metrique/MetricTest.class differ diff --git a/APL2.1/TP06/Metrique/MetricTest.java b/APL2.1/TP06/Metrique/MetricTest.java new file mode 100644 index 0000000..c3e7d73 --- /dev/null +++ b/APL2.1/TP06/Metrique/MetricTest.java @@ -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()); + } +} \ No newline at end of file diff --git a/APL2.1/TP06/Nuancier/Nuance.class b/APL2.1/TP06/Nuancier/Nuance.class new file mode 100644 index 0000000..304d5b2 Binary files /dev/null and b/APL2.1/TP06/Nuancier/Nuance.class differ diff --git a/APL2.1/TP06/Nuancier/Nuance.java b/APL2.1/TP06/Nuancier/Nuance.java new file mode 100644 index 0000000..f8171eb --- /dev/null +++ b/APL2.1/TP06/Nuancier/Nuance.java @@ -0,0 +1,30 @@ +import java.awt.*; +import javax.swing.*; + +public class Nuance extends Panel { + private Panel tagBox; + private Label colorTag; + private Color color; + + private void createNuance(String colorCode) { + tagBox = new Panel(); + tagBox.setBackground(Color.BLACK); + tagBox.setSize(new Dimension(getWidth(), 20)); + color = Color.decode(colorCode); + this.setBackground(color); + this.add(tagBox); + } + + public Nuance(String colorCode) { + super(); + setPreferredSize(new Dimension(100, 100)); + createNuance(colorCode); + } + + public Nuance(String colorCode, int x, int y) { + super(); + setPreferredSize(new Dimension(100, 100)); + setSize(new Dimension(x, y)); + createNuance(colorCode); + } +} \ No newline at end of file diff --git a/APL2.1/TP06/Nuancier/TestNuance.class b/APL2.1/TP06/Nuancier/TestNuance.class new file mode 100644 index 0000000..e57c96d Binary files /dev/null and b/APL2.1/TP06/Nuancier/TestNuance.class differ diff --git a/APL2.1/TP06/Nuancier/TestNuance.java b/APL2.1/TP06/Nuancier/TestNuance.java new file mode 100644 index 0000000..a8e98fb --- /dev/null +++ b/APL2.1/TP06/Nuancier/TestNuance.java @@ -0,0 +1,18 @@ +import javax.swing.*; +import java.awt.*; + +public class TestNuance { + public static void main(String[] args) { + JFrame fenetre = new JFrame("Damier"); + fenetre.setSize(500, 300); + fenetre.setLocation(100, 100); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + fenetre.setLayout(new GridLayout(1, 3)); + + fenetre.add(new Nuance("#FF0000", 100, 100)); + fenetre.add(new Nuance("#00FF00", 100, 100)); + fenetre.add(new Nuance("#0000FF", 100, 100)); + + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/APL2.1/TP07/Formes/Formes.class b/APL2.1/TP07/Formes/Formes.class new file mode 100644 index 0000000..652357d Binary files /dev/null and b/APL2.1/TP07/Formes/Formes.class differ diff --git a/APL2.1/TP07/Formes/Formes.java b/APL2.1/TP07/Formes/Formes.java new file mode 100644 index 0000000..3a7287f --- /dev/null +++ b/APL2.1/TP07/Formes/Formes.java @@ -0,0 +1,32 @@ +import javax.swing.*; +import java.awt.*; + +class NewJFrame extends JComponent { + public NewJFrame() { + super(); + } + + @Override + protected void paintComponent(Graphics brush) { + Graphics newBrush = brush.create(); + + if (this.isOpaque()) { + newBrush.setColor(this.getBackground()); + newBrush.fillRect(0, 0, this.getWidth(), this.getHeight()); + } + + newBrush.setColor(this.getForeground()); + + } +} + +public class Formes { + public static void main(String[] args) { + JFrame f = new JFrame("Formes"); + f.setSize(500, 500); + f.setLocation(100, 100); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + f.setVisible(true); + } +} \ No newline at end of file diff --git a/APL2.1/TP07/Formes/NewJFrame.class b/APL2.1/TP07/Formes/NewJFrame.class new file mode 100644 index 0000000..5d73855 Binary files /dev/null and b/APL2.1/TP07/Formes/NewJFrame.class differ diff --git a/APL2.1/TP07/Formes/cercles.png b/APL2.1/TP07/Formes/cercles.png new file mode 100644 index 0000000..4713bcc Binary files /dev/null and b/APL2.1/TP07/Formes/cercles.png differ