Class Header

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

Header component

This component is used to display headers. The text specified in this component is displayed as a HTML header according to the specified size. The header size can be set between 1 and 6 where 1 is the biggest size and 6 is the smallest.

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

    • Header

      public Header(int size)
      Creates an empty header component in the specified size
      Parameters:
      size - The header size. If size specified less the 1, the header is displayed the bigest size. If specifiedc greather then 6 header is displayed a smallest size.
      Throws:
      IllegalStateException - If the component is set to be both Private and Public, through an annotation.
    • Header

      public Header(int size, String text)
      Creates a header component with the specified text inside it
      Parameters:
      size - The header size. If size specified less the 1, the header is displayed the bigest size. If specifiedc greather then 6 header is displayed a smallest size.
      text - The text that will appear in the component. If specified as null, nothing will appear in it.
      Throws:
      IllegalStateException - If the component is set to be both Private and Public, through an annotation.
    • Header

      public Header(String id, int size, String text)
      Creates a header component with the specified text inside 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.)
      size - The header size. If size specified less the 1, the header is displayed the bigest size. If specifiedc greather then 6 header is displayed a smallest size.
      text - The text that will appear in the component. If specified as null, nothing will appear in it.
      Throws:
      IllegalStateException - If the component is set to be both Private and Public, through an annotation.
    • Header

      public Header(int size, Icon icon, String text)
      Creates a header component with the specified style, icon and text inside it
      Parameters:
      size - The header size. If size specified less the 1, the header is displayed the bigest size. If specifiedc greather then 6 header is displayed a smallest size.
      icon - The icon that will appear in the beginning of the component.For the applicable icons, see the Icon enum. If specified as null, no icon will be used.
      text - The text that will appear in the component. If specified as null, nothing will appear in it.
      Throws:
      IllegalStateException - If the component is set to be both Private and Public, through an annotation.
    • Header

      public Header(String id, int size, Icon icon, String text)
      Creates a header component with the specified style, icon and text inside 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.)
      size - The header size. If size specified less the 1, the header is displayed the bigest size. If specifiedc greather then 6 header is displayed a smallest size.
      icon - The icon that will appear in the beginning of the component.For the applicable icons, see the Icon enum. If specified as null, no icon will be used.
      text - The text that will appear in the component. If specified as null, nothing will appear in it.
      Throws:
      IllegalStateException - If the component is set to be both Private and Public, through an annotation.
  • Method Details

    • setText

      public Header setText(String text)
      Sets the text content of the component
      Parameters:
      text - The text that will appear in the component. If specified as null, nothing will appear in it.
      Returns:
      The header component
    • getText

      public String getText()
      Gets the text content of the component
      Returns:
      The text content or null if no text was specified
    • setIcon

      public Header setIcon(Icon icon)
      Sets the icon of the component
      Parameters:
      icon - The icon that will appear in the beginning of the component.For the applicable icons, see the Icon enum. If specified as null, no icon will be used.
      Returns:
      The header component
    • setTextType

      public Header setTextType(TextType textType)
      Sets the text style of the component
      Parameters:
      textType - The style of the text that's in the component. For the applicable styles, see the TextType enum.
      Returns:
      The header component
    • setSize

      public Header setSize(int size)
      Sets the header size.
      Parameters:
      size - Header size If the specified size is smaller than 1, the header is displayed with the biggest size. If the specified size is greater than 6, the header is displayed with the smallest size.
      Returns:
      Header component
    • getSize

      public int getSize()
      Gets the header size.
      Returns:
      Header size
    • getIcon

      public Icon getIcon()
      Gets the icon of the component
      Returns:
      The icon of the component or null if no icon was specified
    • 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<Header>
      Returns:
      If the componentwas drawn, true, otherwise false