Class Paragraph

All Implemented Interfaces:
Animatable<Paragraph>, CanDrop<Paragraph>, Clickable<Paragraph>, Draggable<Paragraph>, HandleMouseEvents<Paragraph>, Scrollable<Paragraph>, Touchable<Paragraph>

Paragraph component

In the paragraph component, any text or HTML text can be put. Text wrapping will be applied if the text is too long. Text in one paragraph will follow each other with standard space between the lines, but it will have extra space before and after the paragraph.

The paragraph component can have other components added to it, and the same formatting will apply to them, as the text formatting.

Supported events:

AnimationStart AnimationEnd, Click, DoubleClick, MouseDown, MouseDown, MouseLeave, MouseMove, MouseOver, MouseOut, MouseUp, Wheel, Scrollable TouchCancel, TouchEnd, TouchMove, TouchStart, Drop, DragStart, DragEnd

Since:
4.0
Author:
JBStrap
  • Constructor Details

    • Paragraph

      public Paragraph(String text)
      Creates a paragraph component, with the specified text in it.
      Parameters:
      text - The text that will be in the component
      Throws:
      IllegalStateException - If the component is set to be both Private and Public, through an annotation.
    • Paragraph

      public Paragraph(String id, String text)
      Creates a paragraph component, with the specified text in it.
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      text - The text that will be in the component
      Throws:
      IllegalStateException - If the component is set to be both Private and Public, through an annotation.
    • Paragraph

      public Paragraph(Component<?>... components)
      Creates a paragraph component, with the specified components in it
      Parameters:
      components - The components that will be put in the Paragraph component
      Throws:
      IllegalStateException - If the component is set to be both Private and Public, through an annotation.
    • Paragraph

      public Paragraph(String id, Component<?>... components)
      Creates a paragraph component, with the specified components in it
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      components - The components that will be put in the Paragraph component
      Throws:
      IllegalStateException - If the component is set to be both Private and Public, through an annotation.
  • Method Details

    • setText

      public Paragraph setText(String text)
      Sets the Paragraph text
      Parameters:
      text - The text that will be in the component
      Returns:
      The paragraph component
    • getText

      public String getText()
      Gets the Paragraph text
      Returns:
      The Paragraph text or null if the component has no text in it.
    • writeHTML

      public boolean writeHTML(StringWriter writer)
      Description copied from class: Component
      Creates the component's HTML equivalent

      This method doesn't need to be used during application development. This method is used when developing a custom component. When creating a custom component, this method needs to be implemented. In the parameter (StringWriter class) the component's HTML equivalent must be specified, and the method has to return with a Boolean value. This boolean value determines if the component was drawn. If the user doesn't have access right to the component, or if the component couldn't be drawn, it should return with false. Otherwise, it must return with true.

      Specified by:
      writeHTML in class Component<Paragraph>
      Returns:
      If the componentwas drawn, true, otherwise false