From 2498bd4d8052a88bec4430a68bc3222bc38af628 Mon Sep 17 00:00:00 2001
From: qwertzniki6 <104077966+bretzNiklas@users.noreply.github.com>
Date: Tue, 10 Jan 2023 17:14:45 +0100
Subject: [PATCH] Fixed naming of coordinates

---
 .idea/compiler.xml                 |  12 ++++++
 .idea/jarRepositories.xml          |  20 ++++++++++
 .idea/misc.xml                     |   3 +-
 Aufgabe4/Plotter.java              |  60 ++++++++++++++---------------
 out/production/inf3_git/main.class | Bin 4310 -> 4310 bytes
 5 files changed, 64 insertions(+), 31 deletions(-)
 create mode 100644 .idea/jarRepositories.xml

diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index c94edea..0a6e501 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,5 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
+  <component name="CompilerConfiguration">
+    <annotationProcessing>
+      <profile name="Maven default annotation processors profile" enabled="true">
+        <sourceOutputDir name="target/generated-sources/annotations" />
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
+        <outputRelativeToContentRoot value="true" />
+      </profile>
+    </annotationProcessing>
+    <bytecodeTargetLevel>
+      <module name="Aufgabe4Tests" target="15" />
+    </bytecodeTargetLevel>
+  </component>
   <component name="JavacSettings">
     <option name="ADDITIONAL_OPTIONS_OVERRIDE">
       <module name="inf3_git" options="--add-modules java.base" />
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..712ab9d
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RemoteRepositoriesConfiguration">
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Central Repository" />
+      <option name="url" value="https://repo.maven.apache.org/maven2" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Maven Central repository" />
+      <option name="url" value="https://repo1.maven.org/maven2" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="jboss.community" />
+      <option name="name" value="JBoss Community repository" />
+      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
+    </remote-repository>
+  </component>
+</project>
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index d72bc4c..1700c77 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="ProjectRootManager" version="2" project-jdk-name="15" project-jdk-type="JavaSDK">
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_15" default="true" project-jdk-name="15" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/out" />
   </component>
 </project>
\ No newline at end of file
diff --git a/Aufgabe4/Plotter.java b/Aufgabe4/Plotter.java
index 6e61b22..9737b0d 100644
--- a/Aufgabe4/Plotter.java
+++ b/Aufgabe4/Plotter.java
@@ -1,11 +1,9 @@
 import javax.swing.SwingUtilities;
 import javax.swing.JFrame;
 import javax.swing.JPanel;
-import javax.swing.BorderFactory;
 import java.awt.*;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseAdapter;
-import java.awt.geom.Line2D;
 import java.util.Arrays;
 
 public class Plotter {
@@ -30,6 +28,7 @@ public class Plotter {
         JFrame f = new JFrame("Function Plotter");
         f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         f.add(new PlotterPanel(valuesToDraw));
+        f.setLocationRelativeTo(null);
         f.pack();
         f.setVisible(true);
 
@@ -38,20 +37,15 @@ public class Plotter {
 
 class PlotterPanel extends JPanel {
 
+    // int array placeholders that get written into the values that should be displayed
 
-    int[] test = new int[]{-20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10,
-            -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
-            10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
-    int[] test2 = new int[]{-20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10,
-            -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
-            10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
+    int[] xCords = new int[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+    int[] yCords = new int[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 
 
-
-
-
-    final int ZERO_POINT_X = 300;
-    final int ZERO_POINT_Y = 400;
+    // offset values to have coordinates appear in the middle of a 800x600 window
+    final int ZERO_POINT_Y = 300;
+    final int ZERO_POINT_X = 400;
 
     ValuesToDraw valuesToDraw;
 
@@ -63,11 +57,10 @@ class PlotterPanel extends JPanel {
 
         addMouseListener(new MouseAdapter() {
             public void mousePressed(MouseEvent e) {
-                System.out.println("maus gedrückt");
 
 
-                int[] xCordsWithOffset = new int[41];
                 int[] yCordsWithOffset = new int[41];
+                int[] xCordsWithOffset = new int[41];
 
 
                 int i = 0;
@@ -76,11 +69,11 @@ class PlotterPanel extends JPanel {
 
                 for(int cord : xCords) {
 
-                    xCordsWithOffset[i] = (ZERO_POINT_X + (cord * -1 * 10));
+                    yCordsWithOffset[i] = (ZERO_POINT_Y + (cord * -1 * 10));
                     i++;
                 }
 
-                System.out.println(Arrays.toString(xCordsWithOffset));
+                System.out.println(Arrays.toString(yCordsWithOffset));
 
                 int j = 0;
 
@@ -88,15 +81,16 @@ class PlotterPanel extends JPanel {
 
                 for(int cord : yCords) {
                     System.out.print("cords=" + cord);
-                    yCordsWithOffset[j] = ZERO_POINT_Y + (cord * 10);
+                    xCordsWithOffset[j] = ZERO_POINT_X + (cord * 10);
                     j++;
                 }
 
-                System.out.println(Arrays.toString(yCordsWithOffset));
+                System.out.println(Arrays.toString(xCordsWithOffset));
 
 
-                test2 = xCordsWithOffset;
-                test = yCordsWithOffset;
+                PlotterPanel.this.yCords = yCordsWithOffset;
+                PlotterPanel.this.xCords = xCordsWithOffset;
+
 
 
 
@@ -117,32 +111,38 @@ class PlotterPanel extends JPanel {
         super.paintComponent(g);
 
 
-        g.drawLine(400, 0, 400, 600);
-        g.drawLine(0, 300, 800, 300);
+        //paints coordinate system
 
+        // draw x and y axis
+        g.drawLine(400, 50, 400, 550);
+        g.drawLine(150, 300, 650, 300);
 
         //x=0, y=20
-        g.drawLine(375, 100, 425, 100);
+        g.drawLine(395, 100, 405, 100);
         //x=0, y=-20
-        g.drawLine(375, 500, 425, 500);
+        g.drawLine(395, 500, 405, 500);
         //x=-20, y=0
-        g.drawLine(200,275 , 200, 325);
+        g.drawLine(200,295 , 200, 305);
         //x=20, y=0
-        g.drawLine(600,275 , 600, 325);
+        g.drawLine(600,295 , 600, 305);
+
+
+        //paints the lines that are in xCords and yCords
 
-        drawPoints(g);
+        drawLine(g);
 
 
     }
 
 
-    private void drawPoints(Graphics g){
+    private void drawLine(Graphics g){
 
 
 
         Graphics2D g2d = (Graphics2D) g;
+        g2d.setColor(Color.RED);
 
-        g2d.drawPolyline(test, test2, 41);
+        g2d.drawPolyline(xCords, yCords, 41);
 
 
     }
diff --git a/out/production/inf3_git/main.class b/out/production/inf3_git/main.class
index 3623c2b8f2866a0612ae6e474e1cc569363d8d5a..a4e8897c9a16d33fbd487695fe33cf6e329876c6 100644
GIT binary patch
delta 225
zcmWO0%`3xk0LSsy*8!!mCggxEPm#1mSd64?Vrfar!BZq@<sgqKCs#W-`4i-#c2Tab
zuDkgMoRqu#ZlA-uKCgPJo_a0C?pigAYmpGsp+}bi-O|yTlrpVPR?@sdMZ?NQRgAed
z?pDUV2@j^cMCF?q?`D0-`Ly8Mq903s<^3syM$4hyN=RA_{qkYNTF4}nL)Lnjvk{6m
zL&;X{D|X(H+ty@9n_Zpu^xBUkhlU(Qwqpe+k)`6mY4m@l>cW#t&#u(mJXYhye<}qi
ACjbBd

delta 225
zcmW;Gy(`3V0LSsy*MQP5I#QB{>rj^xA{~b$uG57i$znJUB}wXrD^H8n4JLnrEb10z
zwOViU515o)zF9uQ=b_KLk#3}4O36)1t1fN2C3^JfH57GR+LU24GIG&bkX0~h)0oqk
zR!zDz?JhR%&3ZQHRo<IL@0NU6_GQI)T>U8ewHBI{LZ|gGXd`44L)KQ9NZAfKJ0Wj3
z6zqkP{rYE8X__x<aiHB{Bs<dY*nkrw|L<p3okx}nWtI3}Rf{x_t~|L`cl%K5DEtA7
CbtxSH

-- 
GitLab