title: how to access Graphics object outside paintComponent() method
body: <p>Given these methods inside a class extending JPanel:</p>
  
  <pre><code>public void paintComponent(Graphics g) {
          super.paintComponent(g);
  
          g.drawImage(image, 0, 0, null);
          g.setColor(Color.BLACK);
  
      }
  
  public void drawLabels(LinkedList&lt;Label&gt; labelList) {
  
          for (Label l : labelList) {
              // drawString(l.getContent(), l.getX(), l.getY());
          }
  
      }
  </code></pre>
  
  <p>How would I go about accessing the Graphics element from
  paintComponent() inside drawLabels()? I have seen (numerous)
  remarks about not dealing with Graphics objects outside of
  the paintComponent() method, but I can't get my head around
  an alternate solution.</p>
  
  <p>Any helpful suggestions would be appreciated.</p>