title: My pseudo-3D program is drawing a dot instead of a line
body: <p>My one class pseudo-3D program is making a dot at 0,0 instead of a line. I see no reason why it should be doing this. I am relatively new to java. This is also the first time posting a question. If my code is messy, that is why.
  I envisioned this code to be able to make a pseudo-3D that could be shifted on the x, y, and z-axis by inputing a new location with the Calculate3D(x, y, z) method. Thanks for helping!</p>
  
  <pre><code>import java.awt.BorderLayout;
  import java.awt.Color;
  import java.awt.Dimension;
  import java.awt.Graphics;
  import java.awt.Toolkit;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  
  import javax.swing.JButton;
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  import javax.swing.Timer;
  
  public class threeD extends JPanel implements ActionListener {
      public static int WIDTH = 400;
      public static int HEIGHT = 400;
      int counter = 0;
      int x1, y1, x2, y2, FOV = 150, xpo = 0, ypo = 0, zpo = 80, fx1 = 20, fy1 = 20;
  
      private JFrame window;
      private Timer timer;
  
      public static void main(String[] args) {
          new threeD().start();
      }
  
      public void start() {
          window = new JFrame();
          window.setLayout(new BorderLayout());
          window.add(this, BorderLayout.CENTER);
          setPreferredSize(new Dimension(WIDTH, HEIGHT));
          window.pack();
          window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          window.setVisible(true);
          window.setResizable(false);
  
          timer = new Timer(1000 / 60, this);
      }
  
      public void Calculate3D(int x, int y, int z) {
          x1 = fx1;
          y1 = fy1;
          x2 = FOV * ((x + xpo) / (z + zpo));
          y2 = FOV * ((y + ypo) / (z + zpo));
          fx1 = x2;
          fy1 = y2;
          counter++;
      }
  
      @Override
      public void paintComponent(Graphics g) {
          g.setColor(Color.BLACK);
          g.fillRect(0, 0, WIDTH, HEIGHT);
          g.setColor(Color.WHITE);
          for (int i = 0; i &lt; counter; i++) {
              g.drawLine(x1, y1, x2, y2);
          }
      }
  
      @Override
      public void actionPerformed(ActionEvent e) {
          Calculate3D(20, 20, 0);
          repaint();
      }
  }
  </code></pre>