public MyPanel(int w, int h, int colors) {
      GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
      GraphicsDevice gd = ge.getDefaultScreenDevice();
      GraphicsConfiguration gc = gd.getDefaultConfiguration();
      BufferCapabilities bufCaps = gc.getBufferCapabilities();
      ImageCapabilities imgCaps = gc.getImageCapabilities();
      if (bufCaps.isPageFlipping() || bufCaps.isMultiBufferAvailable() ||
          imgCaps.isAccelerated()) {
        System.out.println("Graphics device supports HW acceleration.");
      } else {
        System.out.println("Graphics device does not support HW acceleration.");
      }

      width = w;  height = h;
      im = new BIPixelBuffer(width, height, null, null);
      if (colors == 8)
        im.setPF(VERY_LOW_COLOR_PF);
      else if (colors == 64)
        im.setPF(LOW_COLOR_PF);
      else if (colors == 256)
        im.setPF(MEDIUM_COLOR_PF);
      else if (colors == 65536)
        im.setPF(HIGH_COLOR_PF);
    }