title: When resizing the appletviewer window the canvas size does not change
body: <p>For my CS11 class, I have to write a small applet that draws a horizontal and vertical line on the screen that intersect in the middle of the canvas. One part of the assignment is to be able to move one or both lines when the user clicks on a line and performs a drag. That part is working.</p>
  
  <p>The second part involves handling window resizing. If the window gets resized, the two lines need to be adjusted so they extend from edge to edge of the window.</p>
  
  <p>Our instructions want us to use the Java appletviewer instead of a web browser to launch the program so that the window can be resized while the program is running. We are told to use the following .html file.</p>
  
  <p>ResizableBallController.html</p>
  
  <pre><code>&lt;html&gt;
    &lt;body&gt;
      &lt;applet
        code="ResizableBallController.class"
        archive="objectdraw.jar"
        width="500"
        height="500"&gt;
      &lt;/applet&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I run the program and resize the window the canvas area stays fixed at 500x500 pixels, even as I make the window bigger, and the enlarged area is filled with gray. According to my instructor, the canvas should automatically adjust to extend from edge to edge of the newly resized window.</p>
  
  <p>To test the issue, I am overloading the <code>paint</code> method to add a <code>System.out.println</code> message so I can see how often it is being called and it appears the only time the method is invoked is when the program is launched.</p>
  
  <p>I'm wondering if this could have something to do with Awesome Window Manager or perhaps something else. I say this because the instructor said when you resize the window, the canvas should automatically resize as well.</p>
  
  <p>Here is a portion of the code so you can see what I'm doing:</p>
  
  <pre><code>import objectdraw.*;
  import java.awt.*;
  
  public class ResizableBallController extends WindowController
  {
    // Canvas separators
    private Line xAxis,
                 yAxis;
  
   boolean xAxisGrabbed,
            yAxisGrabbed;
  
    public void begin()
    {
      int canvasWidth              = canvas.getWidth(),
          canvasHeight             = canvas.getHeight(),
          canvasHorizontalMidPoint = canvasWidth / 2,
          canvasVerticalMidpoint   = canvasHeight / 2;
  
      xAxis = new Line(0, canvasVerticalMidpoint,
                       canvasWidth, canvasVerticalMidpoint,
                       canvas);
  
      yAxis = new Line(canvasHorizontalMidPoint, 0,
                       canvasHorizontalMidPoint, canvasHeight,
                       canvas);
    }
  
    public void onMousePress(Location p)
    {
      xAxisGrabbed = xAxis.contains(p);
      yAxisGrabbed = yAxis.contains(p);
    }
  
    public void onMouseDrag(Location p)
    {
      if (xAxisGrabbed)
      {
        xAxis.moveTo(0, p.getY());
      }
  
      if (yAxisGrabbed)
      {
        yAxis.moveTo(p.getX(), 0);
      }
    }
  
    public void paint(java.awt.Graphics g)
    {
      super.paint(g);
      System.out.println("paint called");
    }
  } // End of public class ResizableBallController extends WindowController
  </code></pre>