ui/src/main/java/ucar/nc2/ui/widget/ScaledPanel.java
public Graphics2D getBufferedImageGraphics() {
    if (bImage == null)
      return null;
    Graphics2D g2 = bImage.createGraphics();

    // set graphics attributes
    if (transform == null)
      transform = calcTransform(screenBounds, worldBounds);
    g2.setTransform(transform);
    g2.setStroke(new BasicStroke(0.0f));      // default stroke size is one pixel
    g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
    g2.setBackground(backColor);
    g2.setClip(worldBounds.getRect());

    return g2;
  }
public Graphics2D getBufferedImageGraphics() {
    if (bImage == null)
      return null;
    Graphics2D g2 = bImage.createGraphics();

    // set graphics attributes
    if (transform == null)
      transform = calcTransform(screenBounds, worldBounds);
    g2.setTransform(transform);
    g2.setStroke(new BasicStroke(0.0f));      // default stroke size is one pixel
    g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
    g2.setBackground(backColor);
    g2.setClip(worldBounds.getRect());

    return g2;
  }
User must get this Graphics2D and draw into it when panel needs redrawing