Class P<T extends P<T>>

All Implemented Interfaces:
HgroupElement
Direct Known Subclasses:
Paragraph

public class P<T extends P<T>> extends StyledContainerElement<T> implements HgroupElement
Java representation of the HTML <p> element.

The P class represents a paragraph element, which defines a block of text as a single paragraph. Browsers automatically add margins before and after paragraph elements.

Features:

  • Block-level paragraph container
  • Automatic spacing before and after content
  • Can contain text and inline elements
  • CSS styling support

Usage:


 // Create paragraph with text
 P para = new P("This is a paragraph.");

 // Create paragraph with element
 P para = new P(new Span("Styled text"));

 // Create empty paragraph and add content
 P para = new P();
 para.addText("Paragraph content");
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • invalid reference
    StyledElement
  • Div
  • Constructor Details

    • P

      public P()
      Constructs an empty <p> element.
    • P

      public P(String text)
      Constructs a <p> element with the specified text content.
      Parameters:
      text - the text content for the paragraph
    • P

      public P(Element element)
      Constructs a <p> element containing the specified element.
      Parameters:
      element - the HTML element to add to the paragraph