Class Samp<T extends Samp<T>>


public class Samp<T extends Samp<T>> extends PhrasingContentElement<T>
Represents an HTML <samp> (sample output) element that displays sample program output.

The <samp> element is used to represent sample or quoted output from a computer program, script, or system. It is typically rendered in a monospace font to distinguish it from regular text. This element is part of the semantic markup for technical documentation and programming content.

Features:

  • Semantic representation of program output
  • Displays text in monospace font by default
  • Distinguishes sample output from regular text
  • Inline element that doesn't break text flow
  • Commonly used in technical documentation
  • Can be nested with <kbd> and <code> elements

Usage:


 // Display program output
 Paragraph example = new Paragraph();
 example.addText("The program outputs: ");
 Samp output = new Samp("Hello, World!");

 // Command line output
 Paragraph cmdLine = new Paragraph();
 cmdLine.addText("When you run the command, you see: ");
 Samp result = new Samp("File copied successfully");

 // Error message display
 Samp error = new Samp("Error: File not found");

 // Empty for dynamic content
 Samp dynamic = new Samp();
 dynamic.addText("Output will be displayed here");

 // Combined with other elements
 Paragraph tech = new Paragraph();
 tech.addText("Type ");
 Kbd command = new Kbd("ls -la");
 tech.addElement(command);
 tech.addText(" to see output like: ");
 Samp sample = new Samp("drwxr-xr-x 12 user staff 384");
 tech.addElement(sample);
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Samp

      public Samp()
      Constructs a new empty Samp element.

      Creates an HTML <samp> element with no initial content. Text can be added later using the inherited text methods.

    • Samp

      public Samp(String text)
      Constructs a new Samp element with the specified sample output text.

      Creates an HTML <samp> element containing the specified text, which will be displayed in a monospace font as sample program output.

      Parameters:
      text - the sample output text to display