title: Why is repaint() not reaching the paintComponent() method?
body: <p>I have been working on a Rotating Line project for AP Java at school. All of the support classes are completely done (by my partner) but I have not yet finished my display because of my <code>paintComponent()</code> method not working at all.</p>
  
  <p>I have already asked for help and no one has yet been able to find the error. All I need is to make these polygons paint on the screen and I can do the rest. </p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>imports...
  
  public class Display extends JFrame {
  
  
  protected int screenHeightD = 600;
  protected int screenWidthD = 700;
  private ArrayList &lt;Rotator&gt; planesOnBoard = new ArrayList ();
  private Timer timer;
  private boolean timerOn = true;
  private int timerDuration = 300;
  private int rotateDegValue = 5;
  PlaneFacilitator painter = new PlaneFacilitator();
  JFrame display = new JFrame ("Rotating Line");
  
  
  
  public class PlaneFacilitator extends JComponent {
  
      // takes the double arrays sent by the getXArray/getYArray
      public int [] convertXcrds ( double [] xCrdsD ) {
  
          int [] xCrds = new int[xCrdsD.length];
  
          for ( int i = 0 ; i &lt; xCrdsD.length - 1; i++) {
              double e = xCrdsD [i];
              xCrds [i] = (int) Math.round (e);
          }
          return xCrds;
      }
      public int [] convertYcrds ( double [] yCrdsD ) {
  
          int [] yCrds = new int[yCrdsD.length];
  
          for ( int i = 0 ; i &lt; yCrdsD.length - 1; i++) {
              double e = yCrdsD [i];
              yCrds [i] = (int) Math.round (e);
          }
          return yCrds;
      }
  
      // paints the entire set of planes
      public void paintComponent (Graphics g){
  
          System.out.println("Painted");
          planesOnBoard.add(0, new Rotator (screenWidthD / 2, screenHeightD / 2, new Dimension (screenHeightD, screenWidthD)));
          planesOnBoard.get(0).addPolygon(Color.black, 1, 0, true);
  
  
          for ( Rotator target : planesOnBoard) {
  
              for ( int polyIndex = 0; polyIndex &lt; target.getNumPolygons(); polyIndex++ ) {
  
                  double[] xCrdsD = target.getXArray(polyIndex);  
                  double[] yCrdsD = target.getYArray(polyIndex);
  
                  g.setColor(target.getColor(polyIndex));
                  g.drawPolyline(convertXcrds(xCrdsD), convertYcrds(yCrdsD), xCrdsD.length);
  
              }
  
              g.setColor(Color.green);
              g.drawRect(target.getXOrigin() - 2, target.getYOrigin() - 2, 5, 5);
  
          }
  
      }
  
  }
  
  
  // ctor for display, creates the frame...
  public Display () {
  
      display.setLayout(null);
      display.setSize(screenWidthD, screenHeightD);
      display.setTitle("Rotating Line");
  
      display.add(painter);
      System.out.println(screenWidthD + " " + screenHeightD);
  
      JButton startB = new JButton ("Start");
      JButton pauseB = new JButton ("Pause");
  
      ActionListener pauseBL = new pauseB();
      pauseB.addActionListener(pauseBL);
      ActionListener startBL = new startB();
      startB.addActionListener(startBL);
      startB.setBounds(10, 10, 150, 20);
      pauseB.setBounds(170, 10, 150, 20);
      display.add(startB);
      display.add(pauseB);
  
      display.addMouseListener(new DropDownMenuListener());
  
      display.getContentPane().setBackground(Color.WHITE);
      display.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      display.setVisible(true);
      display.setBounds(0, 0, screenWidthD, screenHeightD);
      display.setResizable(false);
      display.getContentPane().repaint();
  
  }   
  
  // creates a dropdown menu that appears whenever you click on the screen.
  class DropDownMenu extends JPopupMenu {
      public DropDownMenu(){
          JMenuItem addPent = new JMenuItem ("Add a Pentagon");
          JMenuItem addQuad = new JMenuItem ("Add a Quadrilateral");
          JMenuItem addTri = new JMenuItem ("Add a Triangle");
          JMenuItem addLine = new JMenuItem ("Add a Line");
          JMenuItem reverseRot = new JMenuItem ("Reverse the Rotation of the plane");
          JMenuItem addNewPlane = new JMenuItem ("Add a new plane here");
  
          add(addPent);
          add(addQuad);
          add(addTri);
          add(addLine);
          add(reverseRot);
          add(addNewPlane);
  
          addNewPlane.addActionListener(new addPlaneListener());
          addLine.addActionListener(new addLineListener());
          addTri.addActionListener(new addTriListener());
          addQuad.addActionListener(new addQuadListener());
          addPent.addActionListener(new addPentListener());
          reverseRot.addActionListener(new addReverseRotateListener());
  
      }
  }
  
  
  // Lots an lots of listeners...
  int xCrdMenu;
  int yCrdMenu;
  class DropDownMenuListener extends MouseAdapter {
      public void mousePressed(MouseEvent e){
          if (e.isPopupTrigger())
              xCrdMenu = e.getX();
              yCrdMenu = e.getY();
              doPop(e);
      }
  
      public void mouseReleased(MouseEvent e){
          if (e.isPopupTrigger())
              doPop(e);
      }
  
      private void doPop(MouseEvent e){
          DropDownMenu menu = new DropDownMenu();
          menu.show(e.getComponent(), e.getX(), e.getY());
      }
  }
  
  // defines the behavior of the startB
  // starts the timer...rotates x degrees each time
  class startB implements ActionListener {
      public void actionPerformed(ActionEvent e) {
          timer = new Timer();
          timerOn = true;
  
          (timer).scheduleAtFixedRate(new TimerTask() 
          {
              public void run() {
  
                  System.out.println("Time");
  
                  for ( Rotator target : planesOnBoard) {
  
                      for ( int polyIndex = 0; polyIndex &lt; target.getNumPolygons(); polyIndex++ ) {
  
                          target.rotate ( rotateDegValue, polyIndex );
  
                      }
  
                  } painter.repaint();
  
              }
          }
          , (long) timerDuration, (long) timerDuration); 
      } 
  
  }
  
  // defines the behavior for the pause button
  class pauseB implements ActionListener {
      public void actionPerformed(ActionEvent e) {
          if(timerOn == true){
              System.out.println("Pause");
              timer.cancel();;
              timerOn = false;
          }
      } 
  }   
  
  class addPlaneListener implements ActionListener {
      public void actionPerformed(ActionEvent e) {
          //JFrame source = (JFrame) e.getSource();
          Plane added = new Plane (getContentPane().getY(), getContentPane().getX(),getContentPane().getY(),getContentPane().getX());
          planesOnBoard.add(new Rotator (added));
          added.setOrigin(xCrdMenu, yCrdMenu);
  
          painter.repaint();
          System.out.println("Plane");
      } 
  }
  
  class addLineListener implements ActionListener {
      public void actionPerformed(ActionEvent e) {
          planesOnBoard.get(0).addPolygon( new Polygon (Color.black, 1, 180, true, getContentPane().getY(), getContentPane().getX(),getContentPane().getY(),getContentPane().getX()));
          painter.repaint();
          System.out.println("Line");
      }
  }
  
  class addTriListener implements ActionListener {
      public void actionPerformed(ActionEvent e) {
          planesOnBoard.get(0).addPolygon(Color.black, 3, 60, true);
          painter.repaint();
      }
  }
  
  class addQuadListener implements ActionListener {
      public void actionPerformed(ActionEvent e) {
          planesOnBoard.get(0).addPolygon(Color.black, 4, 90, true);
          painter.repaint();
      }
  }
  
  class addPentListener implements ActionListener {
      public void actionPerformed(ActionEvent e) {
          planesOnBoard.get(0).addPolygon(Color.black, 5, 108, true);
          painter.repaint();
      }
  }
  
  class addReverseRotateListener implements ActionListener {
      public void actionPerformed(ActionEvent e) {
          rotateDegValue *= -1;
      }
  }
  
  
  public static void main ( String [] args ) {
  
      Display experiment = new Display();
  
  }
  }
  </code></pre>