Class Superscript<T extends Superscript<T>>


public class Superscript<T extends Superscript<T>> extends Sup<T>
Represents an HTML <sup> element, providing a more descriptive alias for superscript text.

This class extends the Sup class and provides an alternative, more verbose name for creating superscript text elements. It inherits all functionality from the Sup parent class without adding new features, serving as a semantic alias that may be more self-documenting in some contexts.

Features:

  • Provides a descriptive alias for the <sup> HTML element
  • Renders text above the normal baseline
  • Supports text initialization through constructor
  • Inherits all functionality from Sup
  • Ideal for developers who prefer verbose, self-documenting class names

Usage:


 // Create superscript for exponent using verbose name
 Span power = new Span();
 power.addElement(new Text("E=mc"));
 power.addElement(new Superscript("2"));
 // Renders as: E=mc²

 // Create superscript for trademark symbol
 Span brand = new Span();
 brand.addElement(new Text("MyBrand"));
 brand.addElement(new Superscript("TM"));
 // Renders as: MyBrand™

 // Empty superscript
 Superscript sup = new Superscript();
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Superscript

      public Superscript()
      Constructs an empty Superscript element.

      Creates a new <sup> element with no initial text content. Text can be added later using methods inherited from the parent classes.

    • Superscript

      public Superscript(String text)
      Constructs a Superscript element with the specified text content.

      Creates a new <sup> element containing the provided text, which will be rendered above the normal baseline.

      Parameters:
      text - the text content to display as superscript