title: Painting a Canvas in an Applet
body: <p>I currently have a small Java program which I would like to run both on the desktop (ie in a JFrame) and in an applet. Currently all of the drawing and logic are handled by a class extending Canvas. This gives me a very nice main method for the Desktop application:</p>
  
  <pre><code>public static void main(String[] args) {
      MyCanvas canvas = new MyCanvas();
      JFrame frame = MyCanvas.frameCanvas(canvas);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      canvas.loop();
  }
  </code></pre>
  
  <p>Can I do something similar for the applet? Ideally MyCanvas would remain the same for both cases.</p>
  
  <p>Not sure if its important but I am drawing using BufferStrategy with <code>setIgnoreRepaint(true)</code>.</p>
  
  <p><b>Edit</b>: To clarify, my issue seems to be painting the canvas -- since all the painting is being done from the <code>canvas.loop()</code> call.</p>