title: Drawing a polyline in Java
body: <p>I'm doing a task in my programmer course, and need to draw polyLines. I'm using Eclipse and I get no syntax errors with this code. But I don't understand why my polyLine isn't showing when I run the program. Anyone want to enlighten a fresh programmer? :)</p>
  
  <p>Heres the code:</p>
  
  <pre><code>package oppgave4;
  import javax.swing.*;
  import java.awt.*;
  
  class CoordinateSystem extends JPanel {
      @Override
      protected void paintComponent(Graphics g){
          super.paintComponent(g);
          int[] xSin = {1, 2, 3, 4, 5, 6};
          int[] ySin = {1, 2, 3, 4, 5, 6};
  
          g.drawPolyline(xSin, ySin, xSin.length);
          g.drawLine(150, 0, 150, 300);
          g.drawLine(0, 150, 300, 150);
      }   
  }
  </code></pre>
  
  <p>and the Test Program:</p>
  
  <pre><code>package oppgave4;
  import javax.swing.*;
  import java.awt.*;
  
  public class TestProgram extends JFrame{
      public TestProgram(){
          add(new CoordinateSystem());
      }
  
      public static void main(String[] args) {
          TestProgram grid = new TestProgram();
          grid.setSize(300, 300);
          grid.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          grid.setVisible(true);
      }
  }
  </code></pre>