code: public Graphics2D renderContent(Graphics2D g)
      {
  
          if (g.getClip() == null)
              throw new NullPointerException(
                      "Clip is not set on graphics context");
          ViewFactory factory = getEditorKit().getViewFactory();
          if (factory instanceof SwingBoxViewFactory)
          {
              View view = ((SwingBoxViewFactory) factory).getViewport();
              if (view != null) view.paint(g, g.getClip());
          }
  
          return g;
      }
docs: Renders current content to given graphic context, which is updated and
  returned. Context must have set the clip, otherwise NullPointerException
  is thrown.
  
  @param g
  the context to be rendered to.
  @return the Graphics2D context
  @see Graphics2D