Class Subscript<T extends Subscript<T>>


public class Subscript<T extends Subscript<T>> extends Sub<T>
Represents an HTML <sub> element, providing a more descriptive alias for subscript text.

This class extends the Sub class and provides an alternative, more verbose name for creating subscript text elements. It inherits all functionality from the Sub 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 <sub> HTML element
  • Renders text below the normal baseline
  • Supports text initialization through constructor
  • Inherits all functionality from Sub
  • Ideal for developers who prefer verbose, self-documenting class names

Usage:


 // Create subscript for chemical formula using verbose name
 Span water = new Span();
 water.addElement(new Text("H"));
 water.addElement(new Subscript("2"));
 water.addElement(new Text("O"));
 // Renders as: H₂O

 // Create subscript for array indexing
 Subscript index = new Subscript("i");
 // Can be used in: array[i]

 // Empty subscript
 Subscript sub = new Subscript();
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Subscript

      public Subscript()
      Constructs an empty Subscript element.

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

    • Subscript

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

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

      Parameters:
      text - the text content to display as subscript