title: Java: Access applet fields from MouseListener class
body: <p>This is very, <em>very</em> stupid question. I'm supposed to implement mouse processing in seperate class and since I'm a total noob I have problems doing so the right way.</p>
  
  <p>This is my main applet class:</p>
  
  <pre><code>public class MmmuhApplet extends JApplet {
      int x, y;
  
      // stuff (...)
  }
  </code></pre>
  
  <p>And the additional class:</p>
  
  <pre><code>public class MouseProcessing implements MouseListener, MouseMotionListener{
  
      @Override
      public void mouseClicked(MouseEvent arg0) {
          // I want to pass arg0.getX() to variable x. How?
      }
  
      // other methods (...)
  }
  </code></pre>
  
  <p>The only idea that comes to my mind is to store a reference to MmmuhApplet instance in MouseProcessing class and access x/y from there via said reference. Is it a good idea?</p>