code: public ElementBox createElementInstance(ElementBox parent, Element n, NodeData style)
      {
          ElementBox root = new InlineBox(n, (Graphics2D) parent.getGraphics().create(), parent.getVisualContext().create());
          root.setViewport(viewport);
          root.setStyle(style);
          if (root.getDisplay() == ElementBox.DISPLAY_LIST_ITEM)
              root = new ListItemBox((InlineBox) root);
          else if (root.getDisplay() == ElementBox.DISPLAY_TABLE)
              root = new BlockTableBox((InlineBox) root);
          /*else if (root.getDisplay() == ElementBox.DISPLAY_INLINE_TABLE)
              root = new InlineTableBox((InlineBox) root);*/
          else if (root.getDisplay() == ElementBox.DISPLAY_TABLE_CAPTION)
              root = new TableCaptionBox((InlineBox) root);
          else if (root.getDisplay() == ElementBox.DISPLAY_TABLE_ROW_GROUP
                   || root.getDisplay() == ElementBox.DISPLAY_TABLE_HEADER_GROUP
                   || root.getDisplay() == ElementBox.DISPLAY_TABLE_FOOTER_GROUP)
              root = new TableBodyBox((InlineBox) root);
          else if (root.getDisplay() == ElementBox.DISPLAY_TABLE_ROW)
              root = new TableRowBox((InlineBox) root);
          else if (root.getDisplay() == ElementBox.DISPLAY_TABLE_CELL)
              root = new TableCellBox((InlineBox) root);
          else if (root.getDisplay() == ElementBox.DISPLAY_TABLE_COLUMN)
              root = new TableColumn((InlineBox) root);
          else if (root.getDisplay() == ElementBox.DISPLAY_TABLE_COLUMN_GROUP)
              root = new TableColumnGroup((InlineBox) root);
          else if (root.getDisplay() == ElementBox.DISPLAY_INLINE_BLOCK)
              root = new InlineBlockBox((InlineBox) root);
          else if (root.isBlock())
              root = new BlockBox((InlineBox) root);
          return root;
      }
docs: Creates an instance of ElementBox. According to the display: property of the style, the appropriate
  subclass of ElementBox is created (e.g. BlockBox, TableBox, etc.)
  @param n The source DOM element
  @param style Style definition for the node
  @return The created instance of ElementBox