public void paint(Graphics2D g2d) {

    AffineTransform identity = new AffineTransform();

    // draw the page
    g2d.setColor(Color.BLACK);
    g2d.fillRect(0, 0, getWidth(), getHeight());

    // draw the title
    g2d.translate(40, 60);
    g2d.setColor(Color.WHITE);
    g2d.setFont(getFont());
    g2d.drawString(getTitle(), 0, 0);

    // reset the transform
    try {
      g2d.setTransform(identity);
    }
    catch (NullPointerException e) { }

    // write content
    if (hasContent()) {
      String[] cont = getContent().split("\n");
      g2d.setFont(getContentFont());
      g2d.translate(40, 120);
      for (int i = 0; i < cont.length; i++) {
        g2d.drawString(cont[i], 0, 0);
        g2d.translate(0, 30);
      }
      try {
        g2d.setTransform(identity);
      }
      catch (NullPointerException e) { }
      g2d.setFont(getFont());
    }

    // loop through and draw the buttons
    for (int i = 0; i < getButtons().size(); i++) {
      // load the button
      Button b = getButtons().get(i);

      if (!b.isPositioned()) {
        // move to a suitable position
        b.setX(getWidth() / 3);
        b.setY((getHeight() / 3) + (i * 90));
      }

      // draw it
      b.paint(g2d);
    }
  }