Class Legend<T extends Legend<T>>


public class Legend<T extends Legend<T>> extends PhrasingContentElement<T>
Represents the HTML <legend> element for defining a caption for a fieldset.

The Legend class provides a Java representation of the HTML legend element, which defines a caption or title for a <fieldset> grouping. The legend typically appears as text embedded in the fieldset's border, providing a descriptive label for the grouped controls.

Features:

  • Caption text for fieldset groups
  • Embedded border appearance
  • Text element inheritance for styling
  • Simple text-based construction

Usage Example:


 // Create a legend for a fieldset
 Legend legend = new Legend("Personal Information");
 Fieldset fieldset = new Fieldset();
 fieldset.setLegend(legend);

 // Create a legend with constructor
 Fieldset contactFieldset = new Fieldset();
 contactFieldset.setLegend(new Legend("Contact Details"));

 // Use shorthand fieldset constructor
 Fieldset addressFieldset = new Fieldset("Shipping Address");
 
Since:
2016
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Legend

      public Legend()
      Creates a new empty Legend element.
    • Legend

      public Legend(String text)
      Creates a new Legend element with the specified caption text.
      Parameters:
      text - The caption text for the legend.