Class FigCaption<T extends FigCaption<T>>


public class FigCaption<T extends FigCaption<T>> extends PhrasingContentElement<T>
Represents an HTML <figcaption> element.

The <figcaption> element defines a caption or legend for a <figure> element. It provides a textual description or title for the content contained within a figure, such as images, diagrams, code snippets, or other self-contained content. The figcaption can appear as either the first or last child of a figure element.

Features:

  • Provides semantic caption for figure content
  • Can contain text and other inline elements
  • Typically used within a <figure> element
  • Improves accessibility and content organization

Usage:


 // Create a figure with a caption
 Figure figure = new Figure();
 Image img = new Image("chart.png", "Sales Chart");
 FigCaption caption = new FigCaption("Figure 1: Annual Sales Data");

 figure.addElement(img);
 figure.addElement(caption);

 // Create caption without initial text
 FigCaption caption = new FigCaption();
 caption.addText("Photo courtesy of John Doe");
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • FigCaption

      public FigCaption()
      Constructs an empty <figcaption> element.

      Creates a figure caption element without initial text content. Text or other inline elements can be added later using inherited methods.

    • FigCaption

      public FigCaption(String text)
      Constructs a <figcaption> element with the specified text content.
      Parameters:
      text - the caption text for the figure; may be null or empty