title: JPanel not displaying in JFrame after paint is called
body: <p>I am currently imlementing a simple GUI interface to interact with a Lego Mindstorm NXT.
  My current issue resides with a paint issue on my interface.
  When my MainUI loads it calls a method called GirdPanel() which sets up my GridPanel.
  The MainUI, which extends JFrame, then adds this panel to it's JFrame calling.
  Here is the full code for MainUI that matters for this problem.</p>
  
  <pre><code>  public MainUI(){
      setSize(700, 600);
  
      PathPanel pathPanel = new PathPanel(controller);
      add(pathPanel, BorderLayout.WEST);
      CurrentPath.getInstance().addPathDataListener(pathPanel);
      CurrentPath.getInstance().addPointSelectionListener(pathPanel);
  
      gridPanel();
      add(gridPanel, BorderLayout.CENTER);
  
  
      robotControlBar();
      add(robotControls, BorderLayout.NORTH);
  
      setJMenuBar(menuPanel());
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      setVisible(true);
  }
  
  public void gridPanel(){
      gridPanel = new JPanel(new BorderLayout());
      WGraph graph = new WGraph();
  
      gridPanel.add(graph, BorderLayout.CENTER);
  
  }
  </code></pre>
  
  <p>The WGraph is my class that extends JPanel and controls the graphing display for this program.</p>
  
  <pre><code>public class WGraph extends JPanel{
  
  public WGraph(){
      //WGraph Panel property setup
      setLayout(new BorderLayout());
      //Variable creation
      points = new ArrayList&lt;Dot&gt;();
      //Label to display coordinates of selected point
      pointDisplay = new JLabel("Selected point at: None Chosen");
  
      //testPoints(); //Comment Out when test dots not needed.
  
      //Create Graph Panel
      panel = new JPanel();
      panel.setBackground(PANEL_COLOR);
  
      //Mouse Listeners for Panel
      MouseEventHandler mouseListener = new MouseEventHandler();
      panel.addMouseListener(mouseListener);
      panel.addMouseMotionListener(mouseListener);
  
  
      //Adding components to the WGraph panel
      add(pointDisplay, BorderLayout.NORTH);
      add(panel, BorderLayout.CENTER);
  
      repaint();
  }
  public void paintComponent(Graphics g){
      // invokes default painting for JFrame; must have this!
      super.paintComponent(g); 
  
      // paint on the canvas rather than the JFrame
      Graphics pg = panel.getGraphics(); 
      System.out.println("*"); //Print out to see when repaint has been called. for testing only
      int width = panel.getWidth();
      int height = panel.getHeight();
      pg.setColor(GRID_COLOR);
  
      for (int i = 50; i &lt; width; i+=50) {
          pg.drawLine(i, 0, i, height);
      }
  
      for (int i = 50; i &lt; width; i+=50) {
          pg.drawLine(0, i, width, i);
      }
  
      Dot previousPoint = null;
  
      for (int i = 0; i &lt; points.size(); i++) {
          Dot currentPoint = points.get(i);
          currentPoint.draw(pg);
  
          if (previousPoint != null) {
              pg.setColor(Dot.DESELECTED_COLOR);
              pg.drawLine(new Float(previousPoint.getCenter().x).intValue(), 
                      new Float(previousPoint.getCenter().y).intValue(), 
                      new Float(currentPoint.getCenter().x).intValue(), 
                      new Float(currentPoint.getCenter().y).intValue());
          }
  
          previousPoint = currentPoint;
      }
  }
  </code></pre>
  
  <p>So after all that I can describe my problem. 
  The problem is with the graphing panel it will not show up when expected too. 
  I am trying to determine why.
  Currently when the program loads it appears like this. 
  LINK1
  It simple doesn't show the graph at all but when I drop down the JComboBox it appears.
  LINK2
  It also reamins when the JComboBox has an item selected and closes.
  LINK3
  However it disappears again when you try to interact with it.
  LINK4 in comments</p>
  
  <p>Does anybody see any visible error in my JFrame or JPanel construction?
  Do you have any suggestions to help me figure out what is going on?</p>
  
  <p>Side note:
  The Paint function is called three times when the frame first loads.
  Once more when JComboBox opens.
  Once more when JComboBox closes.
  And finally more times when trying to ineract with the graph by clicking on it. </p>